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

Reid Spencer reid at x10sys.com
Thu Jul 7 20:09:14 PDT 2005



Changes in directory llvm/lib/System/Win32:

Path.inc updated: 1.35 -> 1.36
---
Log message:

Final Changes For PR495: http://llvm.cs.uiuc.edu/PR495 :

This chagne just renames some sys::Path methods to ensure they are not 
misused. The Path documentation now divides methods into two dimensions: 
Path/Disk and accessor/mutator. Path accessors and mutators only operate 
on the Path object itself without making any disk accesses. Disk accessors 
and mutators will also access or modify the file system. Because of the
potentially destructive nature of disk mutators, it was decided that all
such methods should end in the work "Disk" to ensure the user recognizes
that the change will occur on the file system. This patch makes that
change. The method name changes are:

makeReadable        -> makeReadableOnDisk
makeWriteable       -> makeWriteableOnDisk
makeExecutable      -> makeExecutableOnDisk
setStatusInfo       -> setStatusInfoOnDisk
createDirectory     -> createDirectoryOnDisk
createFile          -> createFileOnDisk
createTemporaryFile -> createTemporaryFileOnDisk
destroy             -> eraseFromDisk
rename              -> renamePathOnDisk

These changes pass the Linux Deja Gnu tests.



---
Diffs of the changes:  (+19 -12)

 Path.inc |   31 +++++++++++++++++++------------
 1 files changed, 19 insertions(+), 12 deletions(-)


Index: llvm/lib/System/Win32/Path.inc
diff -u llvm/lib/System/Win32/Path.inc:1.35 llvm/lib/System/Win32/Path.inc:1.36
--- llvm/lib/System/Win32/Path.inc:1.35	Thu Jul  7 21:48:42 2005
+++ llvm/lib/System/Win32/Path.inc	Thu Jul  7 22:08:58 2005
@@ -103,10 +103,10 @@
 
   // If there's a directory left over from a previous LLVM execution that
   // happened to have the same process id, get rid of it.
-  result.destroy(true);
+  result.eraseFromDisk(true);
 
   // And finally (re-)create the empty directory.
-  result.createDirectory(false);
+  result.createDirectoryOnDisk(false);
   TempDirectory = new Path(result);
   return *TempDirectory;
 }
@@ -206,6 +206,13 @@
   return fi.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY;
 }
 
+bool
+Path::isHidden() const {
+  // FIXME: implement this correctly for Win32. It should check the hidden file
+  // attribute.
+  return false;
+}
+
 std::string
 Path::getBasename() const {
   // Find the last slash
@@ -322,11 +329,11 @@
   return true;
 }
 
-void Path::makeReadable() {
+void Path::makeReadableOnDisk() {
   // All files are readable on Windows (ignoring security attributes).
 }
 
-void Path::makeWriteable() {
+void Path::makeWriteableOnDisk() {
   DWORD attr = GetFileAttributes(path.c_str());
 
   // If it doesn't exist, we're done.
@@ -339,7 +346,7 @@
   }
 }
 
-void Path::makeExecutable() {
+void Path::makeExecutableOnDisk() {
   // All files are executable on Windows (ignoring security attributes).
 }
 
@@ -447,7 +454,7 @@
 }
 
 bool
-Path::createDirectory( bool create_parents) {
+Path::createDirectoryOnDisk( bool create_parents) {
   // Get a writeable copy of the path name
   char *pathname = reinterpret_cast<char *>(_alloca(path.length()+1));
   path.copy(pathname,path.length());
@@ -495,7 +502,7 @@
 }
 
 bool
-Path::createFile() {
+Path::createFileOnDisk() {
   // Create the file
   HANDLE h = CreateFile(path.c_str(), GENERIC_WRITE, 0, NULL, CREATE_NEW,
                         FILE_ATTRIBUTE_NORMAL, NULL);
@@ -507,7 +514,7 @@
 }
 
 bool
-Path::destroy(bool remove_contents) const {
+Path::eraseFromDisk(bool remove_contents) const {
   if (isFile()) {
     DWORD attr = GetFileAttributes(path.c_str());
 
@@ -571,7 +578,7 @@
         for (std::vector<Path>::iterator I = list.begin(); I != list.end(); 
              ++I) {
           Path &aPath = *I;
-          aPath.destroy(true);
+          aPath.eraseFromDisk(true);
         }
       } else {
         if (GetLastError() != ERROR_FILE_NOT_FOUND)
@@ -615,7 +622,7 @@
 }
 
 bool
-Path::rename(const Path& newName) {
+Path::renamePathOnDisk(const Path& newName) {
   // FIXME: This should rename a directory too.
   if (!isFile()) return false;
   if (!MoveFile(path.c_str(), newName.c_str()))
@@ -625,7 +632,7 @@
 }
 
 bool
-Path::setStatusInfo(const StatusInfo& si) const {
+Path::setStatusInfoOnDisk(const StatusInfo& si) const {
   if (!isFile()) return false;
 
   HANDLE h = CreateFile(path.c_str(),
@@ -705,7 +712,7 @@
 }
 
 bool
-Path::createTemporaryFile(bool reuse_current) {
+Path::createTemporaryFileOnDisk(bool reuse_current) {
   // Make this into a unique file name
   makeUnique( reuse_current );
 






More information about the llvm-commits mailing list