refactored directory names, removed default load dir

updated docs
This commit is contained in:
thrust26 2020-12-24 12:24:23 +01:00
parent 18cc04c9ca
commit db10aea7c7
13 changed files with 51 additions and 45 deletions

View File

@ -32,6 +32,8 @@
* Added sound to Time Machine playback. * Added sound to Time Machine playback.
* Added browser dialogs for user saved files.
* Extended global hotkeys for input devices & ports settings. * Extended global hotkeys for input devices & ports settings.
* Increased sample size for CDFJ+. * Increased sample size for CDFJ+.

View File

@ -3189,6 +3189,16 @@
<td>Make the start path follow ROM launcher navigation.</td> <td>Make the start path follow ROM launcher navigation.</td>
</tr> </tr>
<tr>
<td><pre>-userdir &lt;dir&gt;</pre></td>
<td>Set the path to save user files to.</td>
</tr>
<tr>
<td><pre>-saveuserdir &lt;0|1&gt;</pre></td>
<td>Update the user path when navigating in browser.</td>
</tr>
<tr> <tr>
<td><pre>-maxres &lt;WxH&gt;</pre></td> <td><pre>-maxres &lt;WxH&gt;</pre></td>
<td>Useful for developers, this sets the maximum size of window that <td>Useful for developers, this sets the maximum size of window that

View File

@ -1352,7 +1352,7 @@ string CartDebug::saveDisassembly(string path)
if(path.empty()) if(path.empty())
path = myOSystem.userSaveDir().getPath() path = myOSystem.userDir().getPath()
+ myConsole.properties().get(PropType::Cart_Name) + ".asm"; + myConsole.properties().get(PropType::Cart_Name) + ".asm";
else else
// Append default extension when missing // Append default extension when missing
@ -1380,7 +1380,7 @@ string CartDebug::saveDisassembly(string path)
string CartDebug::saveRom(string path) string CartDebug::saveRom(string path)
{ {
if(path.empty()) if(path.empty())
path = myOSystem.userSaveDir().getPath() path = myOSystem.userDir().getPath()
+ myConsole.properties().get(PropType::Cart_Name) + ".a26"; + myConsole.properties().get(PropType::Cart_Name) + ".a26";
else else
// Append default extension when missing // Append default extension when missing
@ -1406,7 +1406,7 @@ string CartDebug::saveAccessFile(string path)
try try
{ {
if(path.empty()) if(path.empty())
path = myOSystem.userSaveDir().getPath() path = myOSystem.userDir().getPath()
+ myConsole.properties().get(PropType::Cart_Name) + ".csv"; + myConsole.properties().get(PropType::Cart_Name) + ".csv";
else else
// Append default extension when missing // Append default extension when missing

View File

@ -683,7 +683,7 @@ string DebuggerParser::saveScriptFile(string file)
// Use default path if no path is provided // Use default path if no path is provided
if(file.find_first_of(FilesystemNode::PATH_SEPARATOR) == string::npos) if(file.find_first_of(FilesystemNode::PATH_SEPARATOR) == string::npos)
file = debugger.myOSystem.userSaveDir().getPath() + file; file = debugger.myOSystem.userDir().getPath() + file;
FilesystemNode node(file); FilesystemNode node(file);
@ -1144,7 +1144,7 @@ void DebuggerParser::executeDump()
else else
{ {
ostringstream file; ostringstream file;
file << debugger.myOSystem.userSaveDir() file << debugger.myOSystem.userDir()
<< debugger.myOSystem.console().properties().get(PropType::Cart_Name) << "_dbg_"; << debugger.myOSystem.console().properties().get(PropType::Cart_Name) << "_dbg_";
if(execDepth > 0) if(execDepth > 0)
{ {
@ -1240,7 +1240,7 @@ void DebuggerParser::executeExec()
file += ".script"; file += ".script";
FilesystemNode node(file); FilesystemNode node(file);
if (!node.exists()) if (!node.exists())
node = FilesystemNode(debugger.myOSystem.userSaveDir().getPath() + file); node = FilesystemNode(debugger.myOSystem.userDir().getPath() + file);
if (argCount == 2) { if (argCount == 2) {
execPrefix = argStrings[1]; execPrefix = argStrings[1];
@ -1910,7 +1910,7 @@ void DebuggerParser::executeSaveses()
{ {
ostringstream filename; ostringstream filename;
auto timeinfo = BSPF::localTime(); auto timeinfo = BSPF::localTime();
filename << debugger.myOSystem.userSaveDir() filename << debugger.myOSystem.userDir()
<< std::put_time(&timeinfo, "session_%F_%H-%M-%S.txt"); << std::put_time(&timeinfo, "session_%F_%H-%M-%S.txt");
if(argCount && argStrings[0] == "?") if(argCount && argStrings[0] == "?")

View File

@ -466,7 +466,7 @@ void DebuggerDialog::showBrowser(BrowserType type, const string& defaultName)
{ {
createBrowser("Save " + title + " as"); createBrowser("Save " + title + " as");
const string path = instance().userSaveDir().getPath() + defaultName; const string path = instance().userDir().getPath() + defaultName;
myBrowser->show(path, BrowserDialog::FileSave, cmd, kBdCancelCmd); myBrowser->show(path, BrowserDialog::FileSave, cmd, kBdCancelCmd);
} }
} }

View File

@ -217,8 +217,8 @@ void OSystem::loadConfig(const Settings::Options& options)
{ {
// Get base directory and config file from derived class // Get base directory and config file from derived class
// It will decide whether it can override its default location // It will decide whether it can override its default location
string baseDir, cfgFile, defSaveDir, defLoadDir; string baseDir, cfgFile, homeDir, unused;
getBaseDirAndConfig(baseDir, cfgFile, defSaveDir, defLoadDir, getBaseDirAndConfig(baseDir, cfgFile, homeDir, unused,
ourOverrideBaseDirWithApp, ourOverrideBaseDir); ourOverrideBaseDirWithApp, ourOverrideBaseDir);
// Get fully-qualified pathnames, and make directories when needed // Get fully-qualified pathnames, and make directories when needed
@ -228,13 +228,9 @@ void OSystem::loadConfig(const Settings::Options& options)
if(!cfgFile.empty()) if(!cfgFile.empty())
myConfigFile = FilesystemNode(cfgFile); myConfigFile = FilesystemNode(cfgFile);
myDefaultSaveDir = FilesystemNode(defSaveDir); myHomeDir = FilesystemNode(homeDir);
if(!myDefaultSaveDir.isDirectory()) if(!myHomeDir.isDirectory())
myDefaultSaveDir.makeDir(); myHomeDir.makeDir();
myDefaultLoadDir = FilesystemNode(defLoadDir);
if(!myDefaultLoadDir.isDirectory())
myDefaultLoadDir.makeDir();
#ifdef SQLITE_SUPPORT #ifdef SQLITE_SUPPORT
mySettingsDb = make_shared<SettingsDb>(myBaseDir.getPath(), "settings"); mySettingsDb = make_shared<SettingsDb>(myBaseDir.getPath(), "settings");
@ -249,10 +245,10 @@ void OSystem::loadConfig(const Settings::Options& options)
// TODO: check if affected by '-baseDir'and 'basedirinapp' params // TODO: check if affected by '-baseDir'and 'basedirinapp' params
string userDir = mySettings->getString("userdir"); string userDir = mySettings->getString("userdir");
if(userDir.empty()) if(userDir.empty())
userDir = defSaveDir; userDir = homeDir;
myUserSaveDir = FilesystemNode(userDir); myUserDir = FilesystemNode(userDir);
if(!myUserSaveDir.isDirectory()) if(!myUserDir.isDirectory())
myUserSaveDir.makeDir(); myUserDir.makeDir();
Logger::instance().setLogParameters(mySettings->getInt("loglevel"), Logger::instance().setLogParameters(mySettings->getInt("loglevel"),
mySettings->getBool("logtoconsole")); mySettings->getBool("logtoconsole"));
@ -303,7 +299,7 @@ void OSystem::setConfigPaths()
#ifdef PNG_SUPPORT #ifdef PNG_SUPPORT
const string& ssSaveDir = mySettings->getString("snapsavedir"); const string& ssSaveDir = mySettings->getString("snapsavedir");
if(ssSaveDir == EmptyString) if(ssSaveDir == EmptyString)
mySnapshotSaveDir = defaultSaveDir(); mySnapshotSaveDir = userDir();
else else
mySnapshotSaveDir = FilesystemNode(ssSaveDir); mySnapshotSaveDir = FilesystemNode(ssSaveDir);
if(!mySnapshotSaveDir.isDirectory()) if(!mySnapshotSaveDir.isDirectory())
@ -311,7 +307,7 @@ void OSystem::setConfigPaths()
const string& ssLoadDir = mySettings->getString("snaploaddir"); const string& ssLoadDir = mySettings->getString("snaploaddir");
if(ssLoadDir == EmptyString) if(ssLoadDir == EmptyString)
mySnapshotLoadDir = defaultLoadDir(); mySnapshotLoadDir = userDir();
else else
mySnapshotLoadDir = FilesystemNode(ssLoadDir); mySnapshotLoadDir = FilesystemNode(ssLoadDir);
if(!mySnapshotLoadDir.isDirectory()) if(!mySnapshotLoadDir.isDirectory())
@ -346,7 +342,7 @@ void OSystem::setUserDir(const string& path)
{ {
mySettings->setValue("userdir", path); mySettings->setValue("userdir", path);
myUserSaveDir = FilesystemNode(path); myUserDir = FilesystemNode(path);
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -318,12 +318,11 @@ class OSystem
const FilesystemNode& romFile() const { return myRomFile; } const FilesystemNode& romFile() const { return myRomFile; }
/** /**
The default locations for saving and loading various files that The default and user defined locations for saving and loading various
don't already have a specific location. files that don't already have a specific location.
*/ */
const FilesystemNode& defaultSaveDir() const { return myDefaultSaveDir; } const FilesystemNode& homeDir() const { return myHomeDir; }
const FilesystemNode& defaultLoadDir() const { return myDefaultLoadDir; } const FilesystemNode& userDir() const { return myUserDir; }
const FilesystemNode& userSaveDir() const { return myUserSaveDir; }
/** /**
Open the given ROM and return an array containing its contents. Open the given ROM and return an array containing its contents.
@ -556,8 +555,8 @@ class OSystem
private: private:
FilesystemNode myBaseDir, myStateDir, mySnapshotSaveDir, mySnapshotLoadDir, FilesystemNode myBaseDir, myStateDir, mySnapshotSaveDir, mySnapshotLoadDir,
myNVRamDir, myCfgDir, myDefaultSaveDir, myDefaultLoadDir, myNVRamDir, myCfgDir, myHomeDir,
myUserSaveDir; myUserDir;
FilesystemNode myCheatFile, myConfigFile, myPaletteFile, myPropertiesFile; FilesystemNode myCheatFile, myConfigFile, myPaletteFile, myPropertiesFile;
FilesystemNode myRomFile; string myRomMD5; FilesystemNode myRomFile; string myRomMD5;

View File

@ -528,14 +528,14 @@ void Settings::usage() const
<< endl << endl
<< " -saveonexit <none|current| Automatically save state(s) when exiting\n" << " -saveonexit <none|current| Automatically save state(s) when exiting\n"
<< " all> emulation\n" << " all> emulation\n"
<< " -autoslot <1|0> Automatically change to next save slot when\n" << " -autoslot <0|1> Automatically change to next save slot when\n"
<< " state saving\n" << " state saving\n"
<< endl << endl
<< " -rominfo <rom> Display detailed information for the given ROM\n" << " -rominfo <rom> Display detailed information for the given ROM\n"
<< " -listrominfo Display contents of stella.pro, one line per ROM\n" << " -listrominfo Display contents of stella.pro, one line per ROM\n"
<< " entry\n" << " entry\n"
<< endl << endl
<< " -exitlauncher <1|0> On exiting a ROM, go back to the ROM launcher\n" << " -exitlauncher <0|1> On exiting a ROM, go back to the ROM launcher\n"
<< " -launcherpos <XxY> Sets the window position in windowed EOM launcher mode\n" << " -launcherpos <XxY> Sets the window position in windowed EOM launcher mode\n"
<< " -launcherdisplay <number> Sets the display for the ROM launcher\n" << " -launcherdisplay <number> Sets the display for the ROM launcher\n"
<< " -launcherres <WxH> The resolution to use in ROM launcher mode\n" << " -launcherres <WxH> The resolution to use in ROM launcher mode\n"
@ -544,11 +544,14 @@ void Settings::usage() const
<< " medium|large|\n" << " medium|large|\n"
<< " large12|large14|\n" << " large12|large14|\n"
<< " large16>\n" << " large16>\n"
<< " -launcherroms <1|0> Show only ROMs in the launcher (vs. all files)\n"
<< " -launchersubdirs <1|0> Show files from subdirectories too\n"
<< " -romviewer <float> Show ROM info viewer at given zoom level in ROM\n" << " -romviewer <float> Show ROM info viewer at given zoom level in ROM\n"
<< " launcher (use 0 for off)\n" << " launcher (use 0 for off)\n"
<< " -followlauncher <0|1> Default ROM path follows launcher navigation\n" << " -launcherroms <1|0> Show only ROMs in the launcher (vs. all files)\n"
<< " -launchersubdirs <0|1> Show files from subdirectories too\n"
<< " -romdir <dir> Set the path where the ROM launcher will start\n"
<< " -followlauncher <0|1> Default ROM path follows launcher navigation\n"
<< " -userdir <dir> Set the path to save user files to\n"
<< " -saveuserdir <0|1> Update user path when navigating in browser\n"
<< " -lastrom <name> Last played ROM, automatically selected in\n" << " -lastrom <name> Last played ROM, automatically selected in\n"
<< " launcher\n" << " launcher\n"
<< " -romloadcount <number> Number of ROM to load next from multicard\n" << " -romloadcount <number> Number of ROM to load next from multicard\n"
@ -572,10 +575,6 @@ void Settings::usage() const
<< " -ctrlrate <rate> Rate per second of repeated controller input in\n" << " -ctrlrate <rate> Rate per second of repeated controller input in\n"
<< " UI\n" << " UI\n"
<< " -basic_settings <0|1> Display only a basic settings dialog\n" << " -basic_settings <0|1> Display only a basic settings dialog\n"
<< " -romdir <dir> Set the directory where the ROM launcher will\n"
<< " start\n"
<< " -userdir <dir> The directory to save user files to\n"
<< " -saveuserdir <1|0> Update user directory when navigating in browser\n"
<< " -avoxport <name> The name of the serial port where an AtariVox is\n" << " -avoxport <name> The name of the serial port where an AtariVox is\n"
<< " connected\n" << " connected\n"
<< " -holdreset Start the emulator with the Game Reset switch\n" << " -holdreset Start the emulator with the Game Reset switch\n"

View File

@ -271,7 +271,7 @@ void BrowserDialog::handleCommand(CommandSender* sender, int cmd,
break; break;
case kHomeDirCmd: case kHomeDirCmd:
_fileList->setDirectory(FilesystemNode(instance().defaultSaveDir())); _fileList->setDirectory(FilesystemNode(instance().homeDir()));
break; break;
case EditableWidget::kChangedCmd: case EditableWidget::kChangedCmd:

View File

@ -1397,7 +1397,7 @@ void GameInfoDialog::handleCommand(CommandSender* sender, int cmd,
// to re-create it as necessary // to re-create it as necessary
createBrowser("Export properties as"); createBrowser("Export properties as");
myBrowser->show(instance().userSaveDir().getPath() + myGameFile.getNameWithExt(".pro"), myBrowser->show(instance().userDir().getPath() + myGameFile.getNameWithExt(".pro"),
BrowserDialog::FileSave, kExportChosen); BrowserDialog::FileSave, kExportChosen);
break; break;

View File

@ -116,7 +116,7 @@ void LoggerDialog::saveConfig()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void LoggerDialog::saveLogFile() void LoggerDialog::saveLogFile()
{ {
FilesystemNode node = instance().defaultSaveDir(); FilesystemNode node = instance().userDir();
node /= "stella.log"; node /= "stella.log";
try try

View File

@ -131,7 +131,7 @@ void SnapshotDialog::saveConfig()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void SnapshotDialog::setDefaults() void SnapshotDialog::setDefaults()
{ {
mySnapSavePath->setText(instance().userSaveDir().getShortPath()); mySnapSavePath->setText(instance().userDir().getShortPath());
mySnapInterval->setValue(2); mySnapInterval->setValue(2);
mySnapName->setState(false); mySnapName->setState(false);
mySnapSingle->setState(false); mySnapSingle->setState(false);

View File

@ -515,7 +515,7 @@ void UIDialog::setDefaults()
myLauncherHeightSlider->setValue(h); myLauncherHeightSlider->setValue(h);
myLauncherFontPopup->setSelected("medium", ""); myLauncherFontPopup->setSelected("medium", "");
myRomViewerSize->setValue(35); myRomViewerSize->setValue(35);
mySnapLoadPath->setText(instance().defaultLoadDir().getShortPath()); mySnapLoadPath->setText(instance().userDir().getShortPath());
myLauncherExitWidget->setState(false); myLauncherExitWidget->setState(false);
break; break;
} }