Bad handle checks

This commit is contained in:
Reece Wilson 2021-06-30 17:34:49 +01:00
parent f7403c944c
commit 22c1681132

View File

@ -54,7 +54,7 @@ namespace Aurora::IO::FS
auto win32Path = Locale::ConvertFromUTF8(pathNormalized);
auto fileHandle = CreateFileW(win32Path.c_str(), GENERIC_WRITE, FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
if (fileHandle != INVALID_HANDLE_VALUE)
if (fileHandle == INVALID_HANDLE_VALUE)
{
SysPushErrorIO("Couldn't open handle: {}", path);
return false;
@ -102,7 +102,7 @@ namespace Aurora::IO::FS
auto win32Path = Locale::ConvertFromUTF8(NormalizePathRet(path));
auto fileHandle = CreateFileW(win32Path.c_str(), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if (fileHandle != INVALID_HANDLE_VALUE)
if (fileHandle == INVALID_HANDLE_VALUE)
{
SysPushErrorIO("Couldn't open handle: {}", path);
return false;