diff --git a/INSTALL.md b/INSTALL.md index de188040b..de22c8278 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -405,7 +405,13 @@ Here's an example: `` -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: + +`` **Keep in mind that you have to set up your emulator separately from EmulationStation!** diff --git a/es-app/src/FileData.cpp b/es-app/src/FileData.cpp index c21168461..1e15abfa7 100644 --- a/es-app/src/FileData.cpp +++ b/es-app/src/FileData.cpp @@ -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 + "/"; }