From 490868088dba5916a31478dc5bf734fb0fb5b2e0 Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Sat, 7 May 2022 14:11:16 +0200 Subject: [PATCH] (Windows) Fixed an issue where ROM directories could not be created in the root of a device. --- es-app/src/SystemData.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/es-app/src/SystemData.cpp b/es-app/src/SystemData.cpp index 74cfdc4ca..7e5697da3 100644 --- a/es-app/src/SystemData.cpp +++ b/es-app/src/SystemData.cpp @@ -748,11 +748,30 @@ bool SystemData::createSystemDirectories() } if (!Utils::FileSystem::exists(rompath)) { +#if defined(_WIN64) + if (rompath.size() == 3 && rompath[1] == ':' && rompath[2] == '\\') { + if (Utils::FileSystem::driveExists(rompath)) { + LOG(LogInfo) << "ROM directory set to root of device " << rompath; + } + else { + LOG(LogError) << "Device " << rompath << " does not exist"; + return true; + } + } + else { + LOG(LogInfo) << "Creating base ROM directory \"" << rompath << "\"..."; + if (!Utils::FileSystem::createDirectory(rompath)) { + LOG(LogError) << "Couldn't create directory, permission problems or disk full?"; + return true; + } + } +#else LOG(LogInfo) << "Creating base ROM directory \"" << rompath << "\"..."; if (!Utils::FileSystem::createDirectory(rompath)) { LOG(LogError) << "Couldn't create directory, permission problems or disk full?"; return true; } +#endif } else { LOG(LogInfo) << "Base ROM directory \"" << rompath << "\" already exists";