diff --git a/es-app/src/SystemData.cpp b/es-app/src/SystemData.cpp index f52f52efb..447a740ab 100644 --- a/es-app/src/SystemData.cpp +++ b/es-app/src/SystemData.cpp @@ -483,6 +483,9 @@ bool SystemData::loadConfig() #endif path = Utils::String::replace(path, "//", "/"); + // In case ~ is used, expand it to the home directory path. + path = Utils::FileSystem::expandHomePath(path); + // Check that the ROM directory for the system is valid or otherwise abort the // processing. if (!Utils::FileSystem::exists(path)) { diff --git a/es-core/src/utils/FileSystemUtil.cpp b/es-core/src/utils/FileSystemUtil.cpp index 3c0ace8aa..e67142925 100644 --- a/es-core/src/utils/FileSystemUtil.cpp +++ b/es-core/src/utils/FileSystemUtil.cpp @@ -464,10 +464,7 @@ namespace Utils std::string expandHomePath(const std::string& path) { // Expand home path if ~ is used. - std::string expandedPath = path; - - expandedPath = Utils::String::replace(path, "~", Utils::FileSystem::getHomePath()); - return expandedPath; + return Utils::String::replace(path, "~", Utils::FileSystem::getHomePath()); } std::string resolveRelativePath(const std::string& path,