diff --git a/External/FEXCore/Source/Interface/Config/Config.cpp b/External/FEXCore/Source/Interface/Config/Config.cpp index 083e441cb..99948f25b 100644 --- a/External/FEXCore/Source/Interface/Config/Config.cpp +++ b/External/FEXCore/Source/Interface/Config/Config.cpp @@ -237,7 +237,12 @@ namespace FEXCore::Config { } // Expand relative path to absolute - return std::filesystem::absolute(Path); + Path = std::filesystem::absolute(Path); + + // Only return if it exists + if (std::filesystem::exists(Path)) { + return Path; + } } return {}; } @@ -263,7 +268,18 @@ namespace FEXCore::Config { if (FEXCore::Config::Exists(FEXCore::Config::CONFIG_ROOTFS)) { FEX_CONFIG_OPT(PathName, ROOTFS); - ExpandPathIfExists(FEXCore::Config::CONFIG_ROOTFS, PathName()); + auto ExpandedString = ExpandPath(PathName()); + if (!ExpandedString.empty()) { + // Adjust the path if it ended up being relative + FEXCore::Config::EraseSet(FEXCore::Config::CONFIG_ROOTFS, ExpandedString); + } + else if (!PathName().empty()) { + // If the filesystem doesn't exist then let's see if it exists in the fex-emu folder + std::string NamedRootFS = GetDataDirectory() + "RootFS/" + PathName(); + if (std::filesystem::exists(NamedRootFS)) { + FEXCore::Config::EraseSet(FEXCore::Config::CONFIG_ROOTFS, NamedRootFS); + } + } } if (FEXCore::Config::Exists(FEXCore::Config::CONFIG_THUNKHOSTLIBS)) { FEX_CONFIG_OPT(PathName, THUNKHOSTLIBS); diff --git a/External/FEXCore/Source/Interface/Config/Config.json b/External/FEXCore/Source/Interface/Config/Config.json index 19c79f82f..7a6fa8f86 100644 --- a/External/FEXCore/Source/Interface/Config/Config.json +++ b/External/FEXCore/Source/Interface/Config/Config.json @@ -46,7 +46,14 @@ "Default": "", "ShortArg": "R", "Desc": [ - "Which Root filesystem prefix to use" + "Which Root filesystem prefix to use", + "This can be a filesystem path", + "\teg: ~/RootFS/Debian_x86_64", + "Or this can be a name of a rootfs", + "If the named rootfs exists in the FEX data folder then it will use that one", + "\teg: $HOME/.fex-emu/RootFS//", + "Or if you have XDG_DATA_HOME the config will search in that directory", + "\teg: $XDG_DATA_HOME/.fex-emu/RootFS//" ] }, "ThunkHostLibs": {