[llvm-commits] CVS: llvm/lib/System/Unix/Path.inc Signals.inc
Reid Spencer
reid at x10sys.com
Thu Jul 7 20:09:14 PDT 2005
Changes in directory llvm/lib/System/Unix:
Path.inc updated: 1.37 -> 1.38
Signals.inc updated: 1.8 -> 1.9
---
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 -10)
Path.inc | 27 ++++++++++++++++++---------
Signals.inc | 2 +-
2 files changed, 19 insertions(+), 10 deletions(-)
Index: llvm/lib/System/Unix/Path.inc
diff -u llvm/lib/System/Unix/Path.inc:1.37 llvm/lib/System/Unix/Path.inc:1.38
--- llvm/lib/System/Unix/Path.inc:1.37 Thu Jul 7 18:21:43 2005
+++ llvm/lib/System/Unix/Path.inc Thu Jul 7 22:08:58 2005
@@ -246,6 +246,15 @@
return S_ISDIR(buf.st_mode);
}
+bool
+Path::isHidden() const {
+ size_t slash = path.rfind('/');
+ return (slash != std::string::npos &&
+ slash < path.length()-1 &&
+ path[slash+1] == '.') ||
+ (!path.empty() && slash == std::string::npos && path[0] == '.');
+}
+
std::string
Path::getBasename() const {
// Find the last slash
@@ -388,17 +397,17 @@
return true;
}
-void Path::makeReadable() {
+void Path::makeReadableOnDisk() {
if (!AddPermissionBits(path,0444))
ThrowErrno(path + ": can't make file readable");
}
-void Path::makeWriteable() {
+void Path::makeWriteableOnDisk() {
if (!AddPermissionBits(path,0222))
ThrowErrno(path + ": can't make file writable");
}
-void Path::makeExecutable() {
+void Path::makeExecutableOnDisk() {
if (!AddPermissionBits(path,0111))
ThrowErrno(path + ": can't make file executable");
}
@@ -511,7 +520,7 @@
}
bool
-Path::createDirectory( bool create_parents) {
+Path::createDirectoryOnDisk( bool create_parents) {
// Get a writeable copy of the path name
char pathname[MAXPATHLEN];
path.copy(pathname,MAXPATHLEN);
@@ -549,7 +558,7 @@
}
bool
-Path::createFile() {
+Path::createFileOnDisk() {
// Create the file
int fd = ::creat(path.c_str(), S_IRUSR | S_IWUSR);
if (fd < 0)
@@ -560,7 +569,7 @@
}
bool
-Path::createTemporaryFile(bool reuse_current) {
+Path::createTemporaryFileOnDisk(bool reuse_current) {
// Make this into a unique file name
makeUnique( reuse_current );
@@ -574,7 +583,7 @@
}
bool
-Path::destroy(bool remove_contents) const {
+Path::eraseFromDisk(bool remove_contents) const {
// Make sure we're dealing with a directory
if (isFile()) {
if (0 != unlink(path.c_str()))
@@ -604,7 +613,7 @@
}
bool
-Path::rename(const Path& newName) {
+Path::renamePathOnDisk(const Path& newName) {
if (0 != ::rename(path.c_str(), newName.c_str()))
ThrowErrno(std::string("can't rename '") + path + "' as '" +
newName.toString() + "' ");
@@ -612,7 +621,7 @@
}
bool
-Path::setStatusInfo(const StatusInfo& si) const {
+Path::setStatusInfoOnDisk(const StatusInfo& si) const {
struct utimbuf utb;
utb.actime = si.modTime.toPosixTime();
utb.modtime = utb.actime;
Index: llvm/lib/System/Unix/Signals.inc
diff -u llvm/lib/System/Unix/Signals.inc:1.8 llvm/lib/System/Unix/Signals.inc:1.9
--- llvm/lib/System/Unix/Signals.inc:1.8 Thu Jul 7 18:21:43 2005
+++ llvm/lib/System/Unix/Signals.inc Thu Jul 7 22:08:58 2005
@@ -112,7 +112,7 @@
if (DirectoriesToRemove != 0)
while (!DirectoriesToRemove->empty()) {
- DirectoriesToRemove->back().destroy(true);
+ DirectoriesToRemove->back().eraseFromDisk(true);
DirectoriesToRemove->pop_back();
}
More information about the llvm-commits
mailing list