]> git.tdb.fi Git - libs/core.git/commitdiff
Check for ERROR_PATH_NOT_FOUND in adition to ERROR_FILE_NOT_FOUND
authorMikko Rasa <tdb@tdb.fi>
Sun, 22 Aug 2021 09:26:19 +0000 (12:26 +0300)
committerMikko Rasa <tdb@tdb.fi>
Sun, 22 Aug 2021 09:26:19 +0000 (12:26 +0300)
source/fs/windows/stat.cpp
source/io/windows/file.cpp

index a1f19efa7de25f5bd462aa8f08dcde57726161c4..ac9e0c977ac537fcd97bb9230b794ba7f334cc8a 100644 (file)
@@ -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);
index 51fe814a5e29b197f8843d3f4ae1d31653718297..3cbdc4a8ddaf5c6b4c91672479ebf4b1a1383c21 100644 (file)
@@ -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);