[llvm-commits] CVS: llvm/lib/System/Win32/Path.inc

Reid Spencer reid at x10sys.com
Fri Jul 8 10:46:21 PDT 2005



Changes in directory llvm/lib/System/Win32:

Path.inc updated: 1.38 -> 1.39
---
Log message:

Ensure that functions like isDirectory don't fail if the file doesn't
exist but just return false instead.


---
Diffs of the changes:  (+6 -0)

 Path.inc |    6 ++++++
 1 files changed, 6 insertions(+)


Index: llvm/lib/System/Win32/Path.inc
diff -u llvm/lib/System/Win32/Path.inc:1.38 llvm/lib/System/Win32/Path.inc:1.39
--- llvm/lib/System/Win32/Path.inc:1.38	Fri Jul  8 00:02:13 2005
+++ llvm/lib/System/Win32/Path.inc	Fri Jul  8 12:46:10 2005
@@ -213,6 +213,8 @@
 
 bool
 Path::isDirectory() const {
+  if (!exists())
+    return false;
   WIN32_FILE_ATTRIBUTE_DATA fi;
   if (!GetFileAttributesEx(path.c_str(), GetFileExInfoStandard, &fi))
     ThrowError(std::string(path) + ": Can't get status: ");
@@ -221,6 +223,8 @@
 
 bool
 Path::isHidden() const {
+  if (!exists())
+    return false;
   WIN32_FILE_ATTRIBUTE_DATA fi;
   if (!GetFileAttributesEx(path.c_str(), GetFileExInfoStandard, &fi))
     ThrowError(std::string(path) + ": Can't get status: ");
@@ -248,6 +252,8 @@
 
 bool
 Path::isBytecodeFile() const {
+  if (!isFile())
+    return false;
   std::string actualMagic;
   if (!getMagicNumber(actualMagic, 4))
     return false;






More information about the llvm-commits mailing list