files: Use drive letter Z: for root FS (matches wine)

This commit is contained in:
Luke Street 2022-07-04 14:40:11 -04:00 committed by Simon Lindholm
parent d29a78e862
commit 07af846d1c
1 changed files with 3 additions and 3 deletions

View File

@ -15,7 +15,7 @@ namespace files {
std::replace(str.begin(), str.end(), '\\', '/'); std::replace(str.begin(), str.end(), '\\', '/');
// Remove the drive letter // Remove the drive letter
if (str.rfind("c:/", 0) == 0 || str.rfind("C:/", 0) == 0) { if (str.rfind("z:/", 0) == 0 || str.rfind("Z:/", 0) == 0) {
str.erase(0, 2); str.erase(0, 2);
} }
@ -29,7 +29,7 @@ namespace files {
path = path.lexically_normal(); path = path.lexically_normal();
std::filesystem::path newPath = "."; std::filesystem::path newPath = ".";
bool followingExisting = true; bool followingExisting = true;
for (auto component : path) { for (const auto& component : path) {
std::filesystem::path newPath2 = newPath / component; std::filesystem::path newPath2 = newPath / component;
if (followingExisting && !std::filesystem::exists(newPath2) && (component != ".." && component != "." && component != "")) { if (followingExisting && !std::filesystem::exists(newPath2) && (component != ".." && component != "." && component != "")) {
followingExisting = false; followingExisting = false;
@ -60,7 +60,7 @@ namespace files {
std::string str = path; std::string str = path;
if (path.is_absolute()) { if (path.is_absolute()) {
str.insert(0, "C:"); str.insert(0, "Z:");
} }
std::replace(str.begin(), str.end(), '/', '\\'); std::replace(str.begin(), str.end(), '/', '\\');