Added support for using the %ESPATH% variable in the media directory setting.

This commit is contained in:
Leon Styhre 2021-06-29 17:19:47 +02:00
parent 1eaa9ce2d7
commit 4ba2e67e9f

View file

@ -180,9 +180,8 @@ const std::string FileData::getROMDirectory()
#endif
}
// 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.
// If %ESPATH% is used for the ROM path configuration, then expand it to the binary
// directory of ES-DE.
romDirPath = Utils::String::replace(romDirPath, "%ESPATH%", Utils::FileSystem::getExePath());
return romDirPath;
@ -200,7 +199,11 @@ const std::string FileData::getMediaDirectory()
mediaDirPath = mediaDirSetting;
// Expand home path if ~ is used.
mediaDirPath = Utils::FileSystem::expandHomePath(mediaDirPath);
// Expand home symbol if the path starts with ~
// If %ESPATH% is used for the media directory configuration, then expand it to the
// binary directory of ES-DE.
mediaDirPath = Utils::String::replace(
mediaDirPath, "%ESPATH%", Utils::FileSystem::getExePath());
if (mediaDirPath.back() != '/')
mediaDirPath = mediaDirPath + "/";