mirror of https://github.com/stella-emu/stella.git
Windows port compiles again, but 'basedir.txt' functionality removed
- Still need to work on '-basedir' and '-baseinappdir'.
This commit is contained in:
parent
88afab2d22
commit
c5099cf292
|
@ -70,7 +70,7 @@ class HomeFinder
|
|||
}
|
||||
|
||||
private:
|
||||
static string ourHomePath, ourAppDataPath, ourDocumentsPath;
|
||||
static string ourHomePath, ourAppDataPath, ourDocumentsPath, ourDesktopPath;
|
||||
|
||||
// Following constructors and assignment operators not supported
|
||||
HomeFinder(const HomeFinder&) = delete;
|
||||
|
@ -81,6 +81,7 @@ class HomeFinder
|
|||
|
||||
__declspec(selectany) string HomeFinder::ourHomePath = "";
|
||||
__declspec(selectany) string HomeFinder::ourAppDataPath = "";
|
||||
__declspec(selectany) string HomeFinder::ourDesktopPath = "";
|
||||
__declspec(selectany) string HomeFinder::ourDocumentsPath = "";
|
||||
|
||||
#endif
|
||||
|
|
|
@ -26,44 +26,24 @@ void OSystemWINDOWS::getBaseDirAndConfig(string& basedir, string& cfgfile,
|
|||
string& savedir, string& loaddir,
|
||||
bool useappdir, const string& usedir)
|
||||
{
|
||||
#if 0
|
||||
// Check if the base directory should be overridden
|
||||
// Shouldn't normally be necessary, but is useful for those people that
|
||||
// don't want to clutter their 'My Documents' folder
|
||||
bool overrideBasedir = false;
|
||||
FilesystemNode basedirfile("basedir.txt");
|
||||
if(basedirfile.exists())
|
||||
HomeFinder homefinder;
|
||||
FilesystemNode appdata(homefinder.getAppDataPath());
|
||||
if(appdata.isDirectory())
|
||||
{
|
||||
ifstream in(basedirfile.getPath());
|
||||
if(in && in.is_open())
|
||||
{
|
||||
getline(in, basedir);
|
||||
|
||||
// trim leading and trailing spaces
|
||||
size_t spos = basedir.find_first_not_of(" \t");
|
||||
size_t epos = basedir.find_last_not_of(" \t");
|
||||
if(spos != string::npos && epos != string::npos)
|
||||
basedir = basedir.substr(spos, epos-spos+1);
|
||||
|
||||
if(basedir != "") overrideBasedir = true;
|
||||
}
|
||||
basedir = appdata.getShortPath();
|
||||
if(basedir.length() > 1 && basedir[basedir.length() - 1] != '\\')
|
||||
basedir += '\\';
|
||||
basedir += "Stella\\";
|
||||
}
|
||||
#endif
|
||||
savedir = loaddir = "~/"; // FIXME - change this to 'Desktop'
|
||||
|
||||
// If basedir hasn't been specified, use the 'home' directory
|
||||
if(!overrideBasedir)
|
||||
// Check to see if basedir overrides are active
|
||||
if(useappdir)
|
||||
cout << "ERROR: base dir in app folder not supported" << endl;
|
||||
else if(usedir != "")
|
||||
{
|
||||
HomeFinder homefinder;
|
||||
FilesystemNode appdata(homefinder.getAppDataPath());
|
||||
if(appdata.isDirectory())
|
||||
{
|
||||
basedir = appdata.getShortPath();
|
||||
if(basedir.length() > 1 && basedir[basedir.length()-1] != '\\')
|
||||
basedir += '\\';
|
||||
basedir += "Stella\\";
|
||||
}
|
||||
else
|
||||
basedir = ".\\"; // otherwise, default to current directory
|
||||
basedir = FilesystemNode(usedir).getPath();
|
||||
savedir = loaddir = basedir;
|
||||
}
|
||||
|
||||
cfgfile = basedir + "stella.ini";
|
||||
|
|
Loading…
Reference in New Issue