Added support for using the tilde symbol for ROM path tags in es_systems.xml

This commit is contained in:
Leon Styhre 2022-02-16 19:32:02 +01:00
parent 0266a6e7e6
commit ee1a0f7cd3
2 changed files with 4 additions and 4 deletions

View file

@ -483,6 +483,9 @@ bool SystemData::loadConfig()
#endif #endif
path = Utils::String::replace(path, "//", "/"); 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 // Check that the ROM directory for the system is valid or otherwise abort the
// processing. // processing.
if (!Utils::FileSystem::exists(path)) { if (!Utils::FileSystem::exists(path)) {

View file

@ -464,10 +464,7 @@ namespace Utils
std::string expandHomePath(const std::string& path) std::string expandHomePath(const std::string& path)
{ {
// Expand home path if ~ is used. // Expand home path if ~ is used.
std::string expandedPath = path; return Utils::String::replace(path, "~", Utils::FileSystem::getHomePath());
expandedPath = Utils::String::replace(path, "~", Utils::FileSystem::getHomePath());
return expandedPath;
} }
std::string resolveRelativePath(const std::string& path, std::string resolveRelativePath(const std::string& path,