X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Ffs%2Fwindows%2Fstat.cpp;h=36f28a0de3413ba489fbfea524ed9cad9ee999b6;hb=30ce69b5cb05712c3a4903b0f397912119c4f1f9;hp=f0cbdb653a743a0538f1948de4479e1a3490ea8f;hpb=609c9a508cfdc7b42c46c4f21d17639204165a00;p=libs%2Fcore.git diff --git a/source/fs/windows/stat.cpp b/source/fs/windows/stat.cpp index f0cbdb6..36f28a0 100644 --- a/source/fs/windows/stat.cpp +++ b/source/fs/windows/stat.cpp @@ -50,20 +50,20 @@ Stat::Private::Private(const Private &other): Stat::Private::~Private() { - if(owner_id) + if(owner_id!=INVALID_UID) HeapFree(GetProcessHeap(), 0, owner_id); - if(group_id) + if(group_id!=INVALID_GID) HeapFree(GetProcessHeap(), 0, group_id); } void Stat::Private::fill_owner_info(Stat::OwnerInfo &result) { - if(owner_id) + if(owner_id!=INVALID_UID) result.owner = get_account_name(owner_id); else result.owner = "None"; - if(group_id) + if(group_id!=INVALID_GID) result.group = get_account_name(group_id); else result.group = "None"; @@ -77,10 +77,10 @@ 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("CreateFile", err); + throw system_error(format("CreateFile(%s)", path), err); } BY_HANDLE_FILE_INFORMATION info; @@ -91,6 +91,7 @@ Stat Stat::stat(const Path &path) } Stat result; + result.exists = true; if(info.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY) result.type = DIRECTORY; else