![]() |
PIP 5.5.3
Platform-Independent Primitives
|
Local directory. More...
#include <pidir.h>
Classes | |
| class | CurrentDirOverrider |
| Temporarily change working directory. More... | |
Public Member Functions | |
| PIDir (const PIString &dir=PIString()) | |
| Constructs directory with path "dir". | |
| PIDir (const PIFile &file) | |
| Constructs directory with "file" directory path. | |
| bool | isExists () const |
| Returns if this directory exists. | |
| bool | isAbsolute () const |
| Returns if path of this directory is absolute. | |
| bool | isRelative () const |
| Returns if path of this directory is relative. | |
| const PIString & | scanDir () const |
| Returns path of current reading directory. This path valid only while allEntries() functions. | |
| PIString | name () const |
| Returns name of this directory. | |
| PIString | path () const |
| Returns path of this directory. | |
| PIString | absolutePath () const |
| Returns absolute path of this directory. | |
| PIDir & | cleanPath () |
| Simplify path of this directory. More... | |
| PIDir | cleanedPath () const |
| Returns PIDir with simplified path of this directory. | |
| PIString | relative (const PIString &path) const |
| Returns relative to this directory path "path". | |
| PIString | absolute (const PIString &path) const |
| Returns relative to this directory path "path" as absolute path. | |
| PIDir & | setDir (const PIString &path) |
| Set this directory path to simplified "path". | |
| bool | setCurrent () |
| Set this directory path as current for application. | |
| PIVector< PIFile::FileInfo > | entries (const PIRegularExpression ®exp={}) |
| Returns this directory content. More... | |
| PIVector< PIFile::FileInfo > | allEntries (const PIRegularExpression ®exp={}) |
| Returns this directory content recursively. More... | |
| bool | make (bool withParents=true) |
| Make this directory, recursively if "withParents". | |
| bool | remove () |
| Remove this directory. | |
| bool | rename (const PIString &new_name) |
| Rename this directory. | |
| PIDir & | cd (const PIString &path) |
| Change this directory to relative path "path". | |
| PIDir & | up () |
| Change this directory to parent. | |
| bool | operator== (const PIDir &d) const |
| Compare operator. | |
| bool | operator!= (const PIDir &d) const |
| Compare operator. | |
Static Public Member Functions | |
| static PIDir | current () |
| Returns current directory for application. | |
| static PIDir | home () |
| Returns user home directory. | |
| static PIDir | temporary () |
| Returns temporary directory. | |
| static PIVector< PIFile::FileInfo > | allEntries (const PIString &path, const PIRegularExpression ®exp={}) |
| Returns directory "path" content recursively. | |
| static bool | isExists (const PIString &path) |
| Returns if directory "path" exists. | |
| static bool | make (const PIString &path, bool withParents=true) |
| Make directory "path", recursively if "withParents". | |
| static bool | remove (const PIString &path) |
| Remove directory "path". | |
| static bool | rename (const PIString &path, const PIString &new_name) |
| Rename directory "path". | |
| static bool | setCurrent (const PIString &path) |
| Set path "path" as current for application. | |
| static bool | setCurrent (const PIDir &dir) |
| Set directory "dir" path as current for application. | |
| PIDir & PIDir::cleanPath | ( | ) |
Simplify path of this directory.
This function remove repeatedly separators and resolve ".." in path. E.g. "/home/.//user/src/../.." will become "/home".
Returns reference to this PIDir
| PIVector< PIFile::FileInfo > PIDir::entries | ( | const PIRegularExpression & | regexp = {} | ) |
Returns this directory content.
Scan this directory and returns all directories and files in one list, sorted alphabetically. This list contains also "." and ".." members. There are absolute pathes in returned list.
| PIVector< PIFile::FileInfo > PIDir::allEntries | ( | const PIRegularExpression & | regexp = {} | ) |
Returns this directory content recursively.
Scan this directory recursively and returns all directories and files in one list, sorted alphabetically. This list doesn`t contains "." and ".." members. There are absolute pathes in returned list, and files placed after directories in this list.
TODO: resolve symlinks