Katana Plug-in APIs 0.1
Classes | Functions

pystring::os::path

Classes

class  Foundry::Katana::pystring_v1::os::path::EnvironmentInterface

Functions

std::string Foundry::Katana::pystring_v1::os::path::basename (const std::string &path)
 Return the base name of pathname path. This is the second half of the pair returned by split(path). Note that the result of this function is different from the Unix basename program; where basename for '/foo/bar/' returns 'bar', the basename() function returns an empty string ('').
std::string Foundry::Katana::pystring_v1::os::path::dirname (const std::string &path)
 Return the directory name of pathname path. This is the first half of the pair returned by split(path).
bool Foundry::Katana::pystring_v1::os::path::isabs (const std::string &path)
 Return True if path is an absolute pathname. On Unix, that means it begins with a slash, on Windows that it begins with a (back)slash after chopping off a potential drive letter.
std::string Foundry::Katana::pystring_v1::os::path::abspath (const std::string &path, const std::string &cwd)
 Return a normalized absolutized version of the pathname path.
std::string Foundry::Katana::pystring_v1::os::path::join (const std::string &path1, const std::string &path2)
 Join one or more path components intelligently. If any component is an absolute path, all previous components (on Windows, including the previous drive letter, if there was one) are thrown away, and joining continues. The return value is the concatenation of path1, and optionally path2, etc., with exactly one directory separator (os.sep) inserted between components, unless path2 is empty. Note that on Windows, since there is a current directory for each drive, os.path.join("c:", "foo") represents a path relative to the current directory on drive C: (c:foo), not c:\foo.
std::string Foundry::Katana::pystring_v1::os::path::normpath (const std::string &path)
 Normalize a pathname. This collapses redundant separators and up-level references so that A//B, A/B/, A/./B and A/foo/../B all become A/B. It does not normalize the case. On Windows, it converts forward slashes to backward slashes. It should be understood that this may change the meaning of the path if it contains symbolic links!
void Foundry::Katana::pystring_v1::os::path::split (std::string &head, std::string &tail, const std::string &path)
 Split the pathname path into a pair, (head, tail) where tail is the last pathname component and head is everything leading up to that. The tail part will never contain a slash; if path ends in a slash, tail will be empty. If there is no slash in path, head will be empty. If path is empty, both head and tail are empty. Trailing slashes are stripped from head unless it is the root (one or more slashes only). In all cases, join(head, tail) returns a path to the same location as path (but the strings may differ).
void Foundry::Katana::pystring_v1::os::path::splitdrive (std::string &drivespec, std::string &pathspec, const std::string &path)
 Split the pathname path into a pair (drive, tail) where drive is either a drive specification or the empty string. On systems which do not use drive specifications, drive will always be the empty string. In all cases, drive + tail will be the same as path.
void Foundry::Katana::pystring_v1::os::path::splitext (std::string &root, std::string &ext, const std::string &path)
 Split the pathname path into a pair (root, ext) such that root + ext == path, and ext is empty or begins with a period and contains at most one period. Leading periods on the basename are ignored; splitext('.cshrc') returns ('.cshrc', '').
std::string Foundry::Katana::pystring_v1::os::path::expanduser (const std::string &path)
 Expand paths beginning with '~' or '~user'. '~' means the current user's home directory; '~user' means that user's home directory. If the path doesn't begin with '~', or if the user or their home directory is unknown, the path is returned unchanged (leaving error reporting to whatever function is called with the expanded path as argument).
std::string Foundry::Katana::pystring_v1::os::path::expandvars (const std::string &path, EnvironmentInterface *environment=NULL)
 Return the argument with environment variables expanded. Substrings of the form '$name' or '${name}' are replaced by the value of environment variable name. Malformed variable names and references to non-existent variables are left unchanged. By default, environment variables are provided by getenv(), but a custom environment may also be specified.

Function Documentation

std::string Foundry::Katana::pystring_v1::os::path::abspath ( const std::string &  path,
const std::string &  cwd 
)

Return a normalized absolutized version of the pathname path.

NOTE: This differs from the interface of the python equivalent in that it requires you to pass in the current working directory as an argument.

std::string Foundry::Katana::pystring_v1::os::path::join ( const std::string &  path1,
const std::string &  path2 
)

Join one or more path components intelligently. If any component is an absolute path, all previous components (on Windows, including the previous drive letter, if there was one) are thrown away, and joining continues. The return value is the concatenation of path1, and optionally path2, etc., with exactly one directory separator (os.sep) inserted between components, unless path2 is empty. Note that on Windows, since there is a current directory for each drive, os.path.join("c:", "foo") represents a path relative to the current directory on drive C: (c:foo), not c:\foo.

This dispatches based on the compilation OS

 All Classes Functions Variables Typedefs Enumerations Enumerator