From 6b24533c0db7dff346c946b4e5667f27d170573c Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Sat, 11 Jun 2022 18:59:40 +0200 Subject: [PATCH] (Windows) Added support for creating a portable installation in the root of a device, such as E: or F: --- es-app/src/main.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/es-app/src/main.cpp b/es-app/src/main.cpp index f0771aa0d..e714311eb 100644 --- a/es-app/src/main.cpp +++ b/es-app/src/main.cpp @@ -152,7 +152,7 @@ bool parseArgs(int argc, char* argv[]) outputToConsole(false); #endif - std::string portableFilePath = Utils::FileSystem::getExePath() + "/portable.txt"; + std::string portableFilePath {Utils::FileSystem::getExePath() + "/portable.txt"}; // This is primarily intended for portable ES-DE installations on Windows (for example // placed on a USB memory stick) but it may be usable for other operating systems too. @@ -177,8 +177,16 @@ bool parseArgs(int argc, char* argv[]) #if defined(_WIN64) homePath = Utils::String::replace(homePath, "/", "\\"); #endif + bool homeExists {false}; - if (!Utils::FileSystem::exists(homePath)) { + if (Utils::FileSystem::exists(homePath)) + homeExists = true; +#if defined(_WIN64) + else if (homePath.size() == 2 && Utils::FileSystem::driveExists(homePath)) + homeExists = true; +#endif + + if (!homeExists) { std::cerr << "Error: Defined home path \"" << homePath << "\" does not exist\n"; } else if (Utils::FileSystem::isRegularFile(homePath)) {