From ee1a0f7cd3e342de41762677b402e14c156dade5 Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Wed, 16 Feb 2022 19:32:02 +0100 Subject: [PATCH] Added support for using the tilde symbol for ROM path tags in es_systems.xml --- es-app/src/SystemData.cpp | 3 +++ es-core/src/utils/FileSystemUtil.cpp | 5 +---- 2 files changed, 4 insertions(+), 4 deletions(-) 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,