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 browser dialogs for user saved files.
* Extended global hotkeys for input devices & ports settings.
* Increased sample size for CDFJ+.

View File

@ -3189,6 +3189,16 @@
<td>Make the start path follow ROM launcher navigation.</td>
</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>
<td><pre>-maxres &lt;WxH&gt;</pre></td>
<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())
path = myOSystem.userSaveDir().getPath()
path = myOSystem.userDir().getPath()
+ myConsole.properties().get(PropType::Cart_Name) + ".asm";
else
// Append default extension when missing
@ -1380,7 +1380,7 @@ string CartDebug::saveDisassembly(string path)
string CartDebug::saveRom(string path)
{
if(path.empty())
path = myOSystem.userSaveDir().getPath()
path = myOSystem.userDir().getPath()
+ myConsole.properties().get(PropType::Cart_Name) + ".a26";
else
// Append default extension when missing
@ -1406,7 +1406,7 @@ string CartDebug::saveAccessFile(string path)
try
{
if(path.empty())
path = myOSystem.userSaveDir().getPath()
path = myOSystem.userDir().getPath()
+ myConsole.properties().get(PropType::Cart_Name) + ".csv";
else
// Append default extension when missing

View File

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

View File

@ -466,7 +466,7 @@ void DebuggerDialog::showBrowser(BrowserType type, const string& defaultName)
{
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);
}
}

View File

@ -217,8 +217,8 @@ void OSystem::loadConfig(const Settings::Options& options)
{
// Get base directory and config file from derived class
// It will decide whether it can override its default location
string baseDir, cfgFile, defSaveDir, defLoadDir;
getBaseDirAndConfig(baseDir, cfgFile, defSaveDir, defLoadDir,
string baseDir, cfgFile, homeDir, unused;
getBaseDirAndConfig(baseDir, cfgFile, homeDir, unused,
ourOverrideBaseDirWithApp, ourOverrideBaseDir);
// Get fully-qualified pathnames, and make directories when needed
@ -228,13 +228,9 @@ void OSystem::loadConfig(const Settings::Options& options)
if(!cfgFile.empty())
myConfigFile = FilesystemNode(cfgFile);
myDefaultSaveDir = FilesystemNode(defSaveDir);
if(!myDefaultSaveDir.isDirectory())
myDefaultSaveDir.makeDir();
myDefaultLoadDir = FilesystemNode(defLoadDir);
if(!myDefaultLoadDir.isDirectory())
myDefaultLoadDir.makeDir();
myHomeDir = FilesystemNode(homeDir);
if(!myHomeDir.isDirectory())
myHomeDir.makeDir();
#ifdef SQLITE_SUPPORT
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
string userDir = mySettings->getString("userdir");
if(userDir.empty())
userDir = defSaveDir;
myUserSaveDir = FilesystemNode(userDir);
if(!myUserSaveDir.isDirectory())
myUserSaveDir.makeDir();
userDir = homeDir;
myUserDir = FilesystemNode(userDir);
if(!myUserDir.isDirectory())
myUserDir.makeDir();
Logger::instance().setLogParameters(mySettings->getInt("loglevel"),
mySettings->getBool("logtoconsole"));
@ -303,7 +299,7 @@ void OSystem::setConfigPaths()
#ifdef PNG_SUPPORT
const string& ssSaveDir = mySettings->getString("snapsavedir");
if(ssSaveDir == EmptyString)
mySnapshotSaveDir = defaultSaveDir();
mySnapshotSaveDir = userDir();
else
mySnapshotSaveDir = FilesystemNode(ssSaveDir);
if(!mySnapshotSaveDir.isDirectory())
@ -311,7 +307,7 @@ void OSystem::setConfigPaths()
const string& ssLoadDir = mySettings->getString("snaploaddir");
if(ssLoadDir == EmptyString)
mySnapshotLoadDir = defaultLoadDir();
mySnapshotLoadDir = userDir();
else
mySnapshotLoadDir = FilesystemNode(ssLoadDir);
if(!mySnapshotLoadDir.isDirectory())
@ -346,7 +342,7 @@ void OSystem::setUserDir(const string& 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; }
/**
The default locations for saving and loading various files that
don't already have a specific location.
The default and user defined locations for saving and loading various
files that don't already have a specific location.
*/
const FilesystemNode& defaultSaveDir() const { return myDefaultSaveDir; }
const FilesystemNode& defaultLoadDir() const { return myDefaultLoadDir; }
const FilesystemNode& userSaveDir() const { return myUserSaveDir; }
const FilesystemNode& homeDir() const { return myHomeDir; }
const FilesystemNode& userDir() const { return myUserDir; }
/**
Open the given ROM and return an array containing its contents.
@ -556,8 +555,8 @@ class OSystem
private:
FilesystemNode myBaseDir, myStateDir, mySnapshotSaveDir, mySnapshotLoadDir,
myNVRamDir, myCfgDir, myDefaultSaveDir, myDefaultLoadDir,
myUserSaveDir;
myNVRamDir, myCfgDir, myHomeDir,
myUserDir;
FilesystemNode myCheatFile, myConfigFile, myPaletteFile, myPropertiesFile;
FilesystemNode myRomFile; string myRomMD5;

View File

@ -528,14 +528,14 @@ void Settings::usage() const
<< endl
<< " -saveonexit <none|current| Automatically save state(s) when exiting\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"
<< endl
<< " -rominfo <rom> Display detailed information for the given ROM\n"
<< " -listrominfo Display contents of stella.pro, one line per ROM\n"
<< " entry\n"
<< 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"
<< " -launcherdisplay <number> Sets the display for the ROM launcher\n"
<< " -launcherres <WxH> The resolution to use in ROM launcher mode\n"
@ -544,11 +544,14 @@ void Settings::usage() const
<< " medium|large|\n"
<< " large12|large14|\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"
<< " 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"
<< " launcher\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"
<< " UI\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"
<< " connected\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;
case kHomeDirCmd:
_fileList->setDirectory(FilesystemNode(instance().defaultSaveDir()));
_fileList->setDirectory(FilesystemNode(instance().homeDir()));
break;
case EditableWidget::kChangedCmd:

View File

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

View File

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

View File

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

View File

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