PIP 1.7.1 Platform-Independent Primitives

Public Member Functions | List of all members
PIDir Class Reference

Local directory. More...

## Public Member Functions
| PIDir (const PIString &dir=PIString())
| Constructs directory with path "path".
| PIDir (const PIFile &file)
| Constructs directory with "file" directory path "path".
bool | isExists () const
| Returns if this directory is 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
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".
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 ()
| Returns this directory content. More...
PIVector< PIFile::FileInfo > | allEntries ()
| Returns all this directory content. More...

## Detailed Description

Local directory.

# Synopsis

This class provide access to local file. You can manipulate binary content or use this class as text stream. To binary access there are function read(), write(), and many writeBinary() functions. For write variables to file in their text representation threr are many "<<" operators.

## Member Function Documentation

## ◆ scanDir()

const PIString& PIDir::scanDir | ( |  | ) | const
| inline

Returns path of current reading directory. This path valid only while allEntries functions

## ◆ cleanPath()

PIDir & PIDir::cleanPath | ( |  | ) |

Simplify path of this directory.

This function remove repeatedly separators and resolve ".." in path. E.g. "/home/.//peri4/src/../.." will become "/home"
This function returns reference to this PIDir

## ◆ entries()

PIVector< PIFile::FileInfo > PIDir::entries | ( |  | ) |

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.

Attention
  This function doesn`t scan content of inner directories!

## ◆ allEntries()

PIVector< PIFile::FileInfo > PIDir::allEntries | ( |  | ) |

Returns all this directory content.

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