diff --git a/Source/IO/FS/FSPlatformDevices.NT.cpp b/Source/IO/FS/FSPlatformDevices.NT.cpp index 09723200..8f1e0ba2 100644 --- a/Source/IO/FS/FSPlatformDevices.NT.cpp +++ b/Source/IO/FS/FSPlatformDevices.NT.cpp @@ -568,6 +568,11 @@ namespace Aurora::IO::FS } } + if (AuCodepointsToLower(device.devicePath).find("ven_nvme") != AuString::npos) + { + device.bus = EFSBusType::eBusNVMePCIe; + } + bSuccess = pSetupDiGetDeviceRegistryPropertyA(hIntDevInfo, &deviceInfoData, SPDRP_HARDWAREID, &dwDataType, (PBYTE)szBuffer, sizeof(szBuffer), &dwRequiredSize); diff --git a/Source/IO/FS/FSPlatformDevices.cpp b/Source/IO/FS/FSPlatformDevices.cpp index 8913c87b..2e6bc6fa 100644 --- a/Source/IO/FS/FSPlatformDevices.cpp +++ b/Source/IO/FS/FSPlatformDevices.cpp @@ -41,7 +41,8 @@ namespace Aurora::IO::FS AUKN_SYM AuResult GetFSDeviceByFilePath(const AuString &path) { - AuList> devs; + AuPair lastDev = + AuMakePair(0, nullptr); InitPlatformFSCacheAtLoad(); @@ -51,37 +52,31 @@ namespace Aurora::IO::FS return {}; } - { - AU_LOCK_GUARD(gFSDirMutex); + AU_LOCK_GUARD(gFSDirMutex); - for (const auto &refFSDevice : gCachedDevices) + for (const auto &refFSDevice : gCachedDevices) + { + for (const auto &refPart : refFSDevice.partitions) { - for (const auto &refPart : refFSDevice.partitions) // todo sort + for (const auto &refMnt : refPart.filesystemMountPoints) { - for (const auto &refMnt : refPart.filesystemMountPoints) // todo sort + if (AuStartsWith(path, refMnt)) { - if (AuStartsWith(path, refMnt)) + if (AuGet<0>(lastDev) < refMnt.size()) { - devs.push_back(AuMakePair(refMnt.size(), &refFSDevice)); + lastDev = AuMakePair(refMnt.size(), &refFSDevice); } } } } } - if (devs.empty()) + if (AuGet<0>(lastDev) == 0) { return {}; } - std::sort(devs.begin(), - devs.end(), - [](AuPair a, AuPair b) - { - return AuGet<0>(a) > AuGet<0>(b); - }); - - auto copy = AuGet<1>(devs[0]); + auto copy = *AuGet<1>(lastDev); return AuMove(copy); }