Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Polymorphize the OS specific details #15

Open
wtfbbqhax opened this issue May 31, 2016 · 0 comments
Open

Polymorphize the OS specific details #15

wtfbbqhax opened this issue May 31, 2016 · 0 comments

Comments

@wtfbbqhax
Copy link
Member

Cleanup the #if defined(JUCE_<OS>) from Main.cpp.

Maybe something like this to start

class PAL {
public:
    PAL() {}
    virtual bool elevate(const string args) = 0;
    virtual const char* platform() = 0;
    virtual const char* settingsPath() = 0;
    virtual const char* defaultBasePath() = 0;
};

class DarwinPAL : public PAL {
public:
    DarwinPAL()
    {
        settingsDirectory = appDataDirectory.getChildFile("Application Support").getChildFile("Tremulous");
        defaultBasepath = File::getSpecialLocation(File::globalApplicationsDirectory).getChildFile("Tremulous");
    }
    bool elevate(const string args);
    const char *settingsPath();
    const char *defaultBasePath();
}
bool DarwinPAL::elevate(const string args)
{ ... }
const char* DarwinPAL::platform()
{ return "osx"; }

...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant