[llvm-commits] CVS: llvm/lib/System/Unix/Path.cpp
Reid Spencer
reid at x10sys.com
Sun Nov 14 15:31:16 PST 2004
Changes in directory llvm/lib/System/Unix:
Path.cpp updated: 1.11 -> 1.12
---
Log message:
Implement functionality suggested from code review: getStatusInfo should
returnn false if the file doesn't exist rather than throw ane exception.
---
Diffs of the changes: (+4 -1)
Index: llvm/lib/System/Unix/Path.cpp
diff -u llvm/lib/System/Unix/Path.cpp:1.11 llvm/lib/System/Unix/Path.cpp:1.12
--- llvm/lib/System/Unix/Path.cpp:1.11 Sun Nov 14 16:08:36 2004
+++ llvm/lib/System/Unix/Path.cpp Sun Nov 14 17:30:38 2004
@@ -239,8 +239,10 @@
return path.substr(pos+1);
}
-void
+bool
Path::getStatusInfo(StatusInfo& info) {
+ if (!isFile() || !readable())
+ return false;
struct stat buf;
if (0 != stat(path.c_str(), &buf)) {
ThrowErrno(std::string("Can't get status: ")+path);
@@ -253,6 +255,7 @@
info.isDir = S_ISDIR(buf.st_mode);
if (info.isDir && path[path.length()-1] != '/')
path += '/';
+ return true;
}
bool
More information about the llvm-commits
mailing list