From 4ba2e67e9f3af22306d94e59baebb817dfa3e1ea Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Tue, 29 Jun 2021 17:19:47 +0200 Subject: [PATCH] Added support for using the %ESPATH% variable in the media directory setting. --- es-app/src/FileData.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/es-app/src/FileData.cpp b/es-app/src/FileData.cpp index aff94a8ce..44901508f 100644 --- a/es-app/src/FileData.cpp +++ b/es-app/src/FileData.cpp @@ -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 + "/";