From: Mikko Rasa Date: Mon, 23 Jun 2008 20:52:17 +0000 (+0000) Subject: Recognize FileNotFound on win32 X-Git-Tag: io-1.0~6 X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=5ed3d4f2ff489d02661aaabb24d4182f76499926;p=libs%2Fcore.git Recognize FileNotFound on win32 --- diff --git a/source/file.cpp b/source/file.cpp index ac51412..6ef3388 100644 --- a/source/file.cpp +++ b/source/file.cpp @@ -57,7 +57,13 @@ File::File(const string &fn, Mode m, CreateMode cm) handle=CreateFile(fn.c_str(), flags, 0, 0, create_flags, FILE_ATTRIBUTE_NORMAL, 0); if(handle==INVALID_HANDLE_VALUE) - throw SystemError(format("Can't open file '%s'", fn), GetLastError()); + { + int err=GetLastError(); + if(err==ERROR_FILE_NOT_FOUND) + throw FileNotFound("Can't find file "+fn, fn); + else + throw SystemError(format("Can't open file '%s'", fn), GetLastError()); + } #else int flags=0; switch(mode&M_RDWR)