From f177b67e1f102c33fd86b029c5c6cd9761e84b27 Mon Sep 17 00:00:00 2001 From: Jamie Reece Wilson Date: Wed, 13 Sep 2023 03:48:10 +0100 Subject: [PATCH] [*] GetLastError() == ERROR_FILE_EXISTS fast path --- Source/IO/AuIOHandle.NT.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Source/IO/AuIOHandle.NT.cpp b/Source/IO/AuIOHandle.NT.cpp index 56063cc7..8a0298e0 100644 --- a/Source/IO/AuIOHandle.NT.cpp +++ b/Source/IO/AuIOHandle.NT.cpp @@ -197,7 +197,8 @@ namespace Aurora::IO if (hFileHandle == INVALID_HANDLE_VALUE) { - if (AuFS::FileExists(pathex.c_str())) + if (GetLastError() == ERROR_FILE_EXISTS || + AuFS::FileExists(pathex.c_str())) { SysPushErrorResourceExists("File {} already exists", create.path); return false; @@ -253,7 +254,8 @@ namespace Aurora::IO if (hFileHandle == INVALID_HANDLE_VALUE) { - if (AuFS::FileExists(pathex.c_str())) + if (GetLastError() == ERROR_FILE_EXISTS || + AuFS::FileExists(pathex.c_str())) { SysPushErrorResourceExists("File {} already exists", create.path); return false;