+ // Path Manglers
+ //
+ typedef std::list<std::string> PathCompList_t; // a list of path components
+ typedef std::list<std::string> PathList_t; // a list of paths
+
+ bool PathExists(const std::string& Path); // true if the path exists in the filesystem
+ bool PathIsFile(const std::string& Path); // true if the path exists in the filesystem and is a file
+ bool PathIsDirectory(const std::string& Path); // true if the path exists in the filesystem and is a directory
+ fsize_t FileSize(const std::string& Path); // returns the size of a regular file, 0 for a directory or device
+ bool PathsAreEquivalent(const std::string& lhs, const std::string& rhs); // true if paths point to the same filesystem entry
+
+ // split and reassemble pats as lists of path components
+ PathCompList_t& PathToComponents(const std::string& Path, PathCompList_t& CList, char separator = '/'); // removes '//'
+ std::string ComponentsToPath(const PathCompList_t& CList, char separator = '/');
+ std::string ComponentsToAbsolutePath(const PathCompList_t& CList, char separator = '/'); // add separator to the front
+ bool PathHasComponents(const std::string& Path, char separator = '/'); // true if paths starts with separator
+
+ bool PathIsAbsolute(const std::string& Path, char separator = '/'); // true if path begins with separator
+ std::string PathMakeAbsolute(const std::string& Path, char separator = '/'); // compute position of relative path using getcwd()
+ std::string PathMakeLocal(const std::string& Path, const std::string& Parent); // remove Parent from front of Path, if it exists
+ std::string PathMakeCanonical(const std::string& Path, char separator = '/'); // remove '.' and '..'
+
+ std::string PathBasename(const std::string& Path, char separator = '/'); // returns right-most path element (list back())
+ std::string PathDirname(const std::string& Path, char separator = '/'); // returns everything but the right-most element
+ std::string PathGetExtension(const std::string& Path); // returns everything in the right-most element following the right-most '.'
+ std::string PathSetExtension(const std::string& Path, const std::string& Extension); // empty extension removes '.' as well