Boost logo

Boost :

From: John Maddock (john_at_[hidden])
Date: 2004-06-05 06:49:46


Beman,

I'm committing a patch (below) for my last filesystem patch, basically I've
found another reason why GetFileAttributes can fail when the file does not
exist.

John.

$ cvs diff -u
johnmaddock_at_[hidden]'s password:
cvs diff: Diffing .
Index: operations_posix_windows.cpp
===================================================================
RCS file:
/cvsroot/boost/boost/libs/filesystem/src/operations_posix_windows.cpp,
v
retrieving revision 1.33
diff -u -r1.33 operations_posix_windows.cpp
--- operations_posix_windows.cpp 30 Mar 2004 15:19:58 -0000 1.33
+++ operations_posix_windows.cpp 5 Jun 2004 11:47:23 -0000
@@ -321,10 +321,12 @@
 # else
       if(::GetFileAttributesA( ph.string().c_str() ) == 0xFFFFFFFF)
       {
- if((::GetLastError() == ERROR_FILE_NOT_FOUND) || (::GetLastError()
== ERROR_PATH_NOT_FOUND))
+ UINT err = ::GetLastError();
+ if((err == ERROR_FILE_NOT_FOUND) || (err == ERROR_PATH_NOT_FOUND)
|| (err == ERROR_INVALID_NAME))
             return false; // GetFileAttributes failed because the path does
not exist
          // for any other error we assume the file does exist and fall
through,
          // this may not be the best policy though... (JM 20040330)
+ return true;
       }
       return true;
 # endif


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk