[*] GetLastError() == ERROR_FILE_EXISTS fast path

This commit is contained in:
Reece Wilson 2023-09-13 03:48:10 +01:00
parent 18ac961ac9
commit f177b67e1f

View File

@ -197,7 +197,8 @@ namespace Aurora::IO
if (hFileHandle == INVALID_HANDLE_VALUE) 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); SysPushErrorResourceExists("File {} already exists", create.path);
return false; return false;
@ -253,7 +254,8 @@ namespace Aurora::IO
if (hFileHandle == INVALID_HANDLE_VALUE) 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); SysPushErrorResourceExists("File {} already exists", create.path);
return false; return false;