From: Mikko Rasa Date: Sun, 22 Aug 2021 09:26:19 +0000 (+0300) Subject: Check for ERROR_PATH_NOT_FOUND in adition to ERROR_FILE_NOT_FOUND X-Git-Url: http://git.tdb.fi/?p=libs%2Fcore.git;a=commitdiff_plain;h=2c63690c6315004c1d5e48b84ac1b75d796ea7b2 Check for ERROR_PATH_NOT_FOUND in adition to ERROR_FILE_NOT_FOUND --- 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);