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 #endif
} }
// If %ESPATH% is used for the ROM path configuration, then expand it to the executable // If %ESPATH% is used for the ROM path configuration, then expand it to the binary
// directory of ES. This is useful for a portable emulator installation, for instance on // directory of ES-DE.
// a USB memory stick.
romDirPath = Utils::String::replace(romDirPath, "%ESPATH%", Utils::FileSystem::getExePath()); romDirPath = Utils::String::replace(romDirPath, "%ESPATH%", Utils::FileSystem::getExePath());
return romDirPath; return romDirPath;
@ -200,7 +199,11 @@ const std::string FileData::getMediaDirectory()
mediaDirPath = mediaDirSetting; mediaDirPath = mediaDirSetting;
// Expand home path if ~ is used. // Expand home path if ~ is used.
mediaDirPath = Utils::FileSystem::expandHomePath(mediaDirPath); 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() != '/') if (mediaDirPath.back() != '/')
mediaDirPath = mediaDirPath + "/"; mediaDirPath = mediaDirPath + "/";