From 2c63690c6315004c1d5e48b84ac1b75d796ea7b2 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Sun, 22 Aug 2021 12:26:19 +0300 Subject: [PATCH] Check for ERROR_PATH_NOT_FOUND in adition to ERROR_FILE_NOT_FOUND --- source/fs/windows/stat.cpp | 2 +- source/io/windows/file.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/source/fs/windows/stat.cpp b/source/fs/windows/stat.cpp index a1f19ef..ac9e0c9 100644 --- a/source/fs/windows/stat.cpp +++ b/source/fs/windows/stat.cpp @@ -77,7 +77,7 @@ Stat Stat::stat(const Path &path) if(handle==INVALID_HANDLE_VALUE) { DWORD err = GetLastError(); - if(err==ERROR_FILE_NOT_FOUND) + if(err==ERROR_FILE_NOT_FOUND || err==ERROR_PATH_NOT_FOUND) return Stat(); else throw system_error(format("CreateFile(%s)", path), err); diff --git a/source/io/windows/file.cpp b/source/io/windows/file.cpp index 51fe814..3cbdc4a 100644 --- a/source/io/windows/file.cpp +++ b/source/io/windows/file.cpp @@ -42,7 +42,7 @@ void File::platform_init(const string &fn, CreateMode cm) if(!handle) { int err = GetLastError(); - if(err==ERROR_FILE_NOT_FOUND) + if(err==ERROR_FILE_NOT_FOUND || err==ERROR_PATH_NOT_FOUND) throw file_not_found(fn); else if(err==ERROR_FILE_EXISTS) throw file_already_exists(fn); -- 2.43.0