diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/System/Unix/Path.inc | 8 | ||||
-rw-r--r-- | lib/System/Win32/Path.inc | 16 |
2 files changed, 12 insertions, 12 deletions
diff --git a/lib/System/Unix/Path.inc b/lib/System/Unix/Path.inc index 26f29c0bc0..f26315cea6 100644 --- a/lib/System/Unix/Path.inc +++ b/lib/System/Unix/Path.inc @@ -647,15 +647,15 @@ Path::renamePathOnDisk(const Path& newName) { } bool -Path::setStatusInfoOnDisk(const FileStatus &si) const { +Path::setStatusInfoOnDisk(const FileStatus &si, std::string *ErrStr) const { struct utimbuf utb; utb.actime = si.modTime.toPosixTime(); utb.modtime = utb.actime; if (0 != ::utime(path.c_str(),&utb)) - ThrowErrno(path + ": can't set file modification time"); + return GetErrno(path + ": can't set file modification time", ErrStr); if (0 != ::chmod(path.c_str(),si.mode)) - ThrowErrno(path + ": can't set mode"); - return true; + return GetErrno(path + ": can't set mode", ErrStr); + return false; } void diff --git a/lib/System/Win32/Path.inc b/lib/System/Win32/Path.inc index a7c7d21bcf..7c14ea7df4 100644 --- a/lib/System/Win32/Path.inc +++ b/lib/System/Win32/Path.inc @@ -693,9 +693,9 @@ Path::renamePathOnDisk(const Path& newName) { } bool -Path::setStatusInfoOnDisk(const FileStatus &si) const { +Path::setStatusInfoOnDisk(const FileStatus &si, std::string *ErrStr) const { // FIXME: should work on directories also. - if (!isFile()) return false; + if (!isFile()) return true; HANDLE h = CreateFile(path.c_str(), FILE_READ_ATTRIBUTES | FILE_WRITE_ATTRIBUTES, @@ -705,14 +705,14 @@ Path::setStatusInfoOnDisk(const FileStatus &si) const { FILE_ATTRIBUTE_NORMAL, NULL); if (h == INVALID_HANDLE_VALUE) - return false; + return true; BY_HANDLE_FILE_INFORMATION bhfi; if (!GetFileInformationByHandle(h, &bhfi)) { DWORD err = GetLastError(); CloseHandle(h); SetLastError(err); - ThrowError(path + ": GetFileInformationByHandle: "); + return GetError(path + ": GetFileInformationByHandle: ", ErrStr); } FILETIME ft; @@ -722,7 +722,7 @@ Path::setStatusInfoOnDisk(const FileStatus &si) const { CloseHandle(h); if (!ret) { SetLastError(err); - ThrowError(path + ": SetFileTime: "); + return GetError(path + ": SetFileTime: ", ErrStr); } // Best we can do with Unix permission bits is to interpret the owner @@ -731,17 +731,17 @@ Path::setStatusInfoOnDisk(const FileStatus &si) const { if (bhfi.dwFileAttributes & FILE_ATTRIBUTE_READONLY) { if (!SetFileAttributes(path.c_str(), bhfi.dwFileAttributes & ~FILE_ATTRIBUTE_READONLY)) - ThrowError(path + ": SetFileAttributes: "); + return GetError(path + ": SetFileAttributes: ", ErrStr); } } else { if (!(bhfi.dwFileAttributes & FILE_ATTRIBUTE_READONLY)) { if (!SetFileAttributes(path.c_str(), bhfi.dwFileAttributes | FILE_ATTRIBUTE_READONLY)) - ThrowError(path + ": SetFileAttributes: "); + return GetError(path + ": SetFileAttributes: ", ErrStr); } } - return true; + return false; } void |