]> git.tdb.fi Git - libs/core.git/blobdiff - source/io/windows/file.cpp
Check for ERROR_PATH_NOT_FOUND in adition to ERROR_FILE_NOT_FOUND
[libs/core.git] / source / io / windows / file.cpp
index f6943adb3cb397cf3be67c8f76f4a9989cd9a2d2..3cbdc4a8ddaf5c6b4c91672479ebf4b1a1383c21 100644 (file)
@@ -38,11 +38,11 @@ void File::platform_init(const string &fn, CreateMode cm)
        sec_attr.lpSecurityDescriptor = 0;
        sec_attr.bInheritHandle = !!(mode&M_INHERIT);
 
-       *handle = CreateFile(fn.c_str(), flags, share_flags, 0, create_flags, FILE_ATTRIBUTE_NORMAL, 0);
+       *handle = CreateFile(fn.c_str(), flags, share_flags, 0, create_flags, FILE_ATTRIBUTE_NORMAL, &sec_attr);
        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);