Skip to content

Polymorphize the OS specific details #15

@wtfbbqhax

Description

@wtfbbqhax

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"; }

...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions