For UNIX-only, use version-specific config file if it already exists.

- I'm tired of switching between version 5.x and 6.x, and constantly having to reset sound settings :(
- Backporting this to a local copy of 5.x, so both can co-exist, and going forward too
- Not quite ready to advertise this functionality yet ...
This commit is contained in:
Stephen Anthony 2018-09-17 08:36:31 -02:30
parent 56d9bdc163
commit 9890c648cb
1 changed files with 14 additions and 2 deletions

View File

@ -17,6 +17,8 @@
#include <cstdlib>
#include "FSNode.hxx"
#include "Version.hxx"
#include "OSystemUNIX.hxx"
/**
@ -38,7 +40,17 @@ OSystemUNIX::OSystemUNIX()
if(configDir == nullptr) configDir = "~/.config";
string stellaDir = string(configDir) + "/stella";
setBaseDir(stellaDir);
setConfigFile(stellaDir + "/stellarc");
// (Currently) non-documented alternative for using version-specific
// config file
ostringstream buf;
buf << stellaDir << "/stellarc" << "-" << STELLA_VERSION;
// Use version-specific config file only if it already exists
FilesystemNode altConfigFile(buf.str());
if(altConfigFile.exists() && altConfigFile.isWritable())
setConfigFile(altConfigFile.getPath());
else
setConfigFile(stellaDir + "/stellarc");
}