Fixed macOS compilation

- Like Windows, the 'basedir' stuff isn't implemented yet
This commit is contained in:
Stephen Anthony 2019-02-24 20:03:29 -03:30
parent c5099cf292
commit 42f9fc88f1
3 changed files with 41 additions and 37 deletions

View File

@ -141,9 +141,9 @@ class Settings
}
// FIXME - Rework so that these aren't needed; hence no commenting added
const Options& getInternalSettings() const
const Options& getPermanentSettings() const
{ return myPermanentSettings; }
const Options& getExternalSettings() const
const Options& getTemporarySettings() const
{ return myTemporarySettings; }
private:

View File

@ -18,35 +18,25 @@
#include "FSNode.hxx"
#include "OSystemMACOS.hxx"
/**
Each derived class is responsible for calling the following methods
in its constructor:
setBaseDir()
setConfigFile()
See OSystem.hxx for a further explanation
*/
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
OSystemMACOS::OSystemMACOS()
: OSystem()
void OSystemMACOS::getBaseDirAndConfig(string& basedir, string& cfgfile,
string& savedir, string& loaddir,
bool useappdir, const string& usedir)
{
setBaseDir("~/Library/Application Support/Stella/");
basedir = "~/Library/Application Support/Stella/";
cfgfile = "~/Library/Application Support/Stella/stellarc"; // FIXME - actually use this
// This will be overridden, as macOS uses plist files for settings
setConfigFile("~/Library/Application Support/Stella/stellarc");
}
#if 0
// Check to see if basedir overrides are active
if(useappdir)
cout << "ERROR: base dir in app folder not supported" << endl;
else if(usedir != "")
{
basedir = FilesystemNode(usedir).getPath();
savedir = loaddir = basedir;
}
#endif
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string OSystemMACOS::defaultSaveDir() const
{
FilesystemNode desktop("~/Desktop/");
return desktop.isDirectory() ? desktop.getShortPath() : "~/";
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string OSystemMACOS::defaultLoadDir() const
{
return defaultSaveDir();
savedir = loaddir = desktop.isDirectory() ? desktop.getShortPath() : "~/";
}

View File

@ -21,24 +21,38 @@
#include "OSystem.hxx"
/**
This class defines UNIX-like OS's (macOS) system-specific settings.
This class defines an OSystem object for UNIX-like OS's (macOS).
It is responsible for completely implementing getBaseDirAndConfig(),
to set the base directory, config file location, and various other
save/load locations.
@author Mark Grebe, Stephen Anthony
@author Stephen Anthony
*/
class OSystemMACOS : public OSystem
{
public:
/**
Create a new macOS-specific operating system object
*/
OSystemMACOS();
OSystemMACOS() = default;
virtual ~OSystemMACOS() = default;
/**
Returns the default paths for loading/saving files.
Determine the base directory and main configuration file from the
derived class. It can also use hints, as described below.
@param basedir The base directory for all configuration files
@param cfgfile The fully qualified pathname of the config file
(including the base directory)
@param savedir The default directory to save various other files
@param loaddir The default directory to load various other files
@param useappdir A hint that the base dir should be set to the
app directory; not all ports can do this, so
they are free to ignore it
@param usedir A hint that the base dir should be set to this
parameter; not all ports can do this, so
they are free to ignore it
*/
string defaultSaveDir() const override;
string defaultLoadDir() const override;
void getBaseDirAndConfig(string& basedir, string& cfgfile,
string& savedir, string& loaddir,
bool useappdir, const string& usedir) override;
private:
// Following constructors and assignment operators not supported