X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;ds=sidebyside;f=source%2Ffs%2Fstat.cpp;h=d61081b95c9190732627c2e435223eb8f61ba73a;hb=e297edc38785ae5931685f6b1d6efdef97fc5c10;hp=716a7d6a4f82707587aed2a9b452aa4bde87715c;hpb=5a006c4fce0893b63f881a6c9ecd010f15770428;p=libs%2Fcore.git diff --git a/source/fs/stat.cpp b/source/fs/stat.cpp index 716a7d6..d61081b 100644 --- a/source/fs/stat.cpp +++ b/source/fs/stat.cpp @@ -4,6 +4,7 @@ #else #define _FILE_OFFSET_BITS 64 #include +#include #include #include #include @@ -93,7 +94,13 @@ Stat Stat::stat(const Path &path) HANDLE handle; handle = CreateFile(path.str().c_str(), 0, FILE_SHARE_READ, 0, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, 0); if(handle==INVALID_HANDLE_VALUE) - throw system_error("CreateFile"); + { + DWORD err = GetLastError(); + if(err==ERROR_FILE_NOT_FOUND) + return Stat(); + else + throw system_error("CreateFile", err); + } BY_HANDLE_FILE_INFORMATION info; if(!GetFileInformationByHandle(handle, &info))