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

Reid Spencer reid at x10sys.com
Thu Jul 7 16:22:01 PDT 2005



Changes in directory llvm/lib/System/Win32:

Path.inc updated: 1.32 -> 1.33
---
Log message:

For PR495: http://llvm.cs.uiuc.edu/PR495 :
Get rid of the difference between file paths and directory paths. The Path
class now simply stores a path that can refer to either a file or a 
directory. This required various changes in the implementation and interface
of the class with the corresponding impact to its users. Doxygen comments were
also updated to reflect these changes. Interface changes are:

appendDirectory -> appendComponent
appendFile -> appendComponent
elideDirectory -> eraseComponent
elideFile -> eraseComponent
elideSuffix -> eraseSuffix
renameFile -> rename
setDirectory -> set
setFile -> set

Changes pass Dejagnu and llvm-test/SingleSource tests.


---
Diffs of the changes:  (+8 -2)

 Path.inc |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)


Index: llvm/lib/System/Win32/Path.inc
diff -u llvm/lib/System/Win32/Path.inc:1.32 llvm/lib/System/Win32/Path.inc:1.33
--- llvm/lib/System/Win32/Path.inc:1.32	Thu Jul  7 13:21:42 2005
+++ llvm/lib/System/Win32/Path.inc	Thu Jul  7 18:21:43 2005
@@ -195,12 +195,18 @@
 
 bool
 Path::isFile() const {
-  return (isValid() && path[path.length()-1] != '/');
+  WIN32_FILE_ATTRIBUTE_DATA fi;
+  if (!GetFileAttributesEx(path.c_str(), GetFileExInfoStandard, &fi))
+    ThrowError(std::string(path) + ": Can't get status: ");
+  return fi.dwFileAttributes & FILE_ATTRIBUTE_NORMAL;
 }
 
 bool
 Path::isDirectory() const {
-  return (isValid() && path[path.length()-1] == '/');
+  WIN32_FILE_ATTRIBUTE_DATA fi;
+  if (!GetFileAttributesEx(path.c_str(), GetFileExInfoStandard, &fi))
+    ThrowError(std::string(path) + ": Can't get status: ");
+  return fi.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY;
 }
 
 std::string






More information about the llvm-commits mailing list