libcamgm
|
The LiMaL path utility namespace. More...
Classes | |
class | PathInfo |
Wrapper class for ::stat/::lstat and other file/directory related operations. More... | |
class | PathName |
PathName manipulation class. More... | |
Functions | |
bool | operator== (const PathName &lname, const PathName &rname) |
bool | operator!= (const PathName &lname, const PathName &rname) |
PathName | operator+ (const PathName &lname, const PathName &rname) |
std::ostream & | operator<< (std::ostream &ostr, const PathName &path) |
int | createDir (const PathName &path, mode_t mode=0755) |
Create a directory. More... | |
int | createDirRecursive (const PathName &path, mode_t mode=0755) |
int | removeDir (const PathName &path) |
Remove a directory. More... | |
int | removeDirRecursive (const PathName &path) |
Remove a directory recursively. More... | |
int | copyDir (const PathName &srcPath, const PathName &destPath) |
int | readDir (std::list< std::string > &retlist, const PathName &path, bool dots) |
int | removeFile (const PathName &path) |
int | moveFile (const PathName &oldPath, const PathName &newPath) |
int | copyFile (const PathName &file, const PathName &dest) |
int | symLink (const PathName &oldPath, const PathName &newPath) |
int | changeMode (const PathName &path, mode_t mode) |
The LiMaL path utility namespace.
int ca_mgm::path::changeMode | ( | const PathName & | path, |
mode_t | mode | ||
) |
Like '::chmod'. The mode of the file given by path is changed.
int ca_mgm::path::copyDir | ( | const PathName & | srcPath, |
const PathName & | destPath | ||
) |
Like 'cp -a srcPath destPath'. Copy directory tree. srcpath/destpath must be directories. 'basename srcpath' must not exist in destpath.
int ca_mgm::path::copyFile | ( | const PathName & | file, |
const PathName & | dest | ||
) |
Like 'cp file dest'. Copy file to destination file.
int ca_mgm::path::createDir | ( | const PathName & | path, |
mode_t | mode = 0755 |
||
) |
Create a directory.
Like '::mkdir'. Attempt to create a new directory with name 'path'. The parameter 'mode' specifies the permissions bits to use. It is modified by the process's umask in the usual way.
The directory's user ID is set to the process' effective user ID, the group ID to the effective group ID of the process or inherited from the parent directory if the set group ID bit is set or if specified by mount options.
path | The path name of the new directory. |
mode | The permissions bits of the new directory. |
int ca_mgm::path::createDirRecursive | ( | const PathName & | path, |
mode_t | mode = 0755 |
||
) |
Create a directory with parent directories as needed.
Like 'mkdir -p'. Attempt to create a new directory with name 'path' and all parent directories as needed. The parameter 'mode' specifies the permissions bits to use. It is modified by the process's umask in the usual way. No error is reported if the directory already exists.
path | The path name of the new directory. |
mode | The permissions bits of the new directory. |
int ca_mgm::path::moveFile | ( | const PathName & | oldPath, |
const PathName & | newPath | ||
) |
Like '::rename'. Renames a file, moving it between directories if required.
|
inline |
|
inline |
std::ostream& ca_mgm::path::operator<< | ( | std::ostream & | ostr, |
const PathName & | path | ||
) |
|
inline |
int ca_mgm::path::readDir | ( | std::list< std::string > & | retlist, |
const PathName & | path, | ||
bool | dots | ||
) |
Return content of directory via retlist. If dots is false entries starting with '.' are not reported. "." and ".." are never reported.
int ca_mgm::path::removeDir | ( | const PathName & | path | ) |
Remove a directory.
Like '::rmdir'. Delete a directory, which must be empty.
path | The path to the directory. |
int ca_mgm::path::removeDirRecursive | ( | const PathName & | path | ) |
Remove a directory recursively.
Like 'rm -r path'. Delete a directory, recursively removing its contents.
path | The path to the directory. |
int ca_mgm::path::removeFile | ( | const PathName & | path | ) |
Like '::unlink'. Delete a file (symbolic link, socket, fifo or device).
int ca_mgm::path::symLink | ( | const PathName & | oldPath, |
const PathName & | newPath | ||
) |
Like '::symlink'. Creates a symbolic link named newpath which contains the string oldpath. If newpath exists it will not be overwritten.