diff --git a/Source/IO/FS/FS.cpp b/Source/IO/FS/FS.cpp index 5e398186..fd2fbfa8 100644 --- a/Source/IO/FS/FS.cpp +++ b/Source/IO/FS/FS.cpp @@ -276,13 +276,14 @@ namespace Aurora::IO::FS int doubleSlash = 0; char prevC = '\0'; + //for (auto &character : str) for (auto itr = str.begin(); itr != str.end(); - ) + itr++) { - auto &character = *itr; auto holding = *itr; + auto character = holding; if ((character == '\\') || (character == '/')) { @@ -292,25 +293,24 @@ namespace Aurora::IO::FS if (character == '\\' && prevC == '\\') { + *(itr - 1) = '\\'; itr = str.erase(itr); doubleSlash--; + continue; } else { - itr++; + *itr = kPathSplitter; doubleSlash++; } - character = kPathSplitter; #else - itr++; - character = kPathSplitter; + *itr = kPathSplitter; doubleSlash++; #endif } else { - itr++; doubleSlash = 0; } diff --git a/Source/IO/FS/FSPlatformDevices.Linux.cpp b/Source/IO/FS/FSPlatformDevices.Linux.cpp index 5bf9f79c..24a59279 100644 --- a/Source/IO/FS/FSPlatformDevices.Linux.cpp +++ b/Source/IO/FS/FSPlatformDevices.Linux.cpp @@ -34,7 +34,7 @@ namespace Aurora::IO::FS AuString ret; ret.resize(4096); - auto count = readlink(path.c_str(), ret.data(), ret.size()); + auto count = readlink(AuString(path).c_str(), ret.data(), ret.size()); if (count <= 0) { return {}; @@ -47,7 +47,7 @@ namespace Aurora::IO::FS if (ret.size() && ret[0] != '/') { AuROString dir; - AuString path2 = path; + AuString path2(path); path2 = AuReplaceAll(path2, "\\", "\\\\"); if (GoUpToSeparator(dir, path2)) { @@ -81,18 +81,19 @@ namespace Aurora::IO::FS try { // TODO: use roxtl het lookup instead of allocating AuString - auto itr = gCachedStat.find(AuString(path)); + AuString copy(path); + auto itr = gCachedStat.find(copy); if (itr == gCachedStat.end()) { - int err = ::stat(path.c_str(), pstat); + int err = ::stat(copy.c_str(), pstat); if (-1 == err) { - gCachedStat[path] = {}; + gCachedStat[copy] = {}; errno = 0; } else { - gCachedStat[path] = *pstat; + gCachedStat[copy] = *pstat; } return err; } @@ -135,7 +136,7 @@ namespace Aurora::IO::FS return {}; } - auto dev = "/dev/" + path.substr(pos + 1); + auto dev = AuString("/dev/") + AuString(path.substr(pos + 1)); if (!BlockExists(dev)) { return {}; @@ -296,7 +297,7 @@ namespace Aurora::IO::FS if (uCount == 2) { - auto guess = "/sys/block/" + path.substr(5); + auto guess = AuString("/sys/block/") + AuString(path.substr(5)); if (AuFS::DirExists(guess)) { return guess; @@ -313,7 +314,7 @@ namespace Aurora::IO::FS AuStartsWith(path, "/sys/block/")) { // dunno. have fun - return path; + return AuString(path); } else { diff --git a/Source/IO/FS/FSPlatformDevices.NT.cpp b/Source/IO/FS/FSPlatformDevices.NT.cpp index 9d07fd19..41fc3fef 100644 --- a/Source/IO/FS/FSPlatformDevices.NT.cpp +++ b/Source/IO/FS/FSPlatformDevices.NT.cpp @@ -225,7 +225,7 @@ namespace Aurora::IO::FS } } - AUKN_SYM AuUInt32 GetLogicalSectorSizeFromPath(const AuString &path) + AUKN_SYM AuUInt32 GetLogicalSectorSizeFromPath(const AuROString &path) { // TODO: ioctl BLKSSZGET under linux or GetPhysicalSectorSizeFromPath(path) diff --git a/Source/IO/FS/Resources.cpp b/Source/IO/FS/Resources.cpp index b7c7bdee..f0178fa3 100644 --- a/Source/IO/FS/Resources.cpp +++ b/Source/IO/FS/Resources.cpp @@ -85,7 +85,7 @@ namespace Aurora::IO::FS AuString tempPath; if (Process::GetWorkingDirectory(tempPath)) { - tempPath += "/" + fileName; + tempPath += "/" + AuString(fileName); if (FileExists(tempPath)) { path = tempPath; diff --git a/Source/Process/AuProcess.cpp b/Source/Process/AuProcess.cpp index e71251cf..b6575d1e 100644 --- a/Source/Process/AuProcess.cpp +++ b/Source/Process/AuProcess.cpp @@ -337,7 +337,7 @@ namespace Aurora::Process return {}; } #else - auto handle = dlopen(path.c_str(), RTLD_DEEPBIND); + auto handle = dlopen(AuString(path).c_str(), RTLD_DEEPBIND); if (handle == nullptr) { SysPushErrorNested("Could't link dynamic library {}", path); @@ -674,8 +674,8 @@ namespace Aurora::Process if (request.version.size()) { - au += "." + request.version; - base += "." + request.version; + au += AuString(".") + AuString(request.version); + base += AuString(".") + AuString(request.version); } if (ext && Build::kIsNtDerived) diff --git a/Source/Process/AuProcessMap.Linux.cpp b/Source/Process/AuProcessMap.Linux.cpp index eb2d2848..4cf680c0 100644 --- a/Source/Process/AuProcessMap.Linux.cpp +++ b/Source/Process/AuProcessMap.Linux.cpp @@ -138,7 +138,7 @@ namespace Aurora::Process name = kSectionNameFile; } - AuOptional optProcessPath; + AuOptional optProcessPath; if (AuCmdLine::gHackLoader.size()) { optProcessPath = GetProcessFullPath();