Added %ESPATH% support to the ROMDirectory setting.

This commit is contained in:
Leon Styhre 2020-07-10 21:20:52 +02:00
parent 472a973f66
commit 29d2ccf201
2 changed files with 15 additions and 6 deletions

View file

@ -405,7 +405,13 @@ Here's an example:
`<string name="ROMDirectory" value="~/games/roms" />`
Keep in mind though that you still need to group the ROMs into directories corresponding to the system names. Well at least if you want to use the default es_systems.cfg file. See below how to customize that file, which gives you full control over the location of the ROMs.
Keep in mind though that you still need to group the ROMs into directories corresponding to the platform names in es_systems.cfg.
There is also support to add the variable %ESPATH% to the ROM directory setting, this will expand to the path where the ES executable is started from. This is useful for a portable emulator installation, for example on a USB memory stick.
Here is such an example:
`<string name="ROMDirectory" value="%ESPATH%/../roms" />`
**Keep in mind that you have to set up your emulator separately from EmulationStation!**

View file

@ -116,6 +116,11 @@ const std::string FileData::getROMDirectory()
romDirPath = romDirPath + "/";
}
// If %ESPATH% is used for the ROM path configuration, then expand it to the executable
// directory of ES. This is useful for a portable emulator installation, for instance on
// a USB memory stick.
romDirPath = Utils::String::replace(romDirPath, "%ESPATH%", Utils::FileSystem::getExePath());
return romDirPath;
}
@ -129,12 +134,10 @@ const std::string FileData::getMediaDirectory()
}
else {
mediaDirPath = mediaDirSetting;
// Expand home path if ~ is used.
mediaDirPath = Utils::FileSystem::expandHomePath(mediaDirPath);
// Expand home symbol if the path starts with ~
if (mediaDirPath[0] == '~') {
mediaDirPath.erase(0, 1);
mediaDirPath.insert(0, Utils::FileSystem::getHomePath());
}
if (mediaDirPath.back() != '/')
mediaDirPath = mediaDirPath + "/";
}