#include <fs_entry.hh>
Basic operations | |
FSEntry (const std::string &path) | |
FSEntry (const FSEntry &other) | |
~FSEntry () | |
const FSEntry & | operator= (const FSEntry &other) |
Modification operations | |
const FSEntry & | operator/= (const FSEntry &rhs) |
const FSEntry & | operator/= (const std::string &rhs) |
FSEntry | operator/ (const std::string &rhs) const PALUDIS_ATTRIBUTE((warn_unused_result)) |
Comparison operators | |
bool | operator< (const FSEntry &) const |
bool | operator== (const FSEntry &) const |
Filesystem queries | |
bool | exists () const PALUDIS_ATTRIBUTE((warn_unused_result)) |
bool | is_directory () const PALUDIS_ATTRIBUTE((warn_unused_result)) |
bool | is_directory_or_symlink_to_directory () const PALUDIS_ATTRIBUTE((warn_unused_result)) |
bool | is_regular_file () const PALUDIS_ATTRIBUTE((warn_unused_result)) |
bool | is_regular_file_or_symlink_to_regular_file () const PALUDIS_ATTRIBUTE((warn_unused_result)) |
bool | is_symbolic_link () const PALUDIS_ATTRIBUTE((warn_unused_result)) |
bool | is_device () const PALUDIS_ATTRIBUTE((warn_unused_result)) |
bool | is_fifo () const PALUDIS_ATTRIBUTE((warn_unused_result)) |
bool | has_permission (const FSUserGroup &user_group, const FSPermission &fs_perm) const PALUDIS_ATTRIBUTE((warn_unused_result)) |
mode_t | permissions () const PALUDIS_ATTRIBUTE((warn_unused_result)) |
FSEntry | realpath () const PALUDIS_ATTRIBUTE((warn_unused_result)) |
FSEntry | realpath_if_exists () const PALUDIS_ATTRIBUTE((warn_unused_result)) |
std::string | readlink () const PALUDIS_ATTRIBUTE((warn_unused_result)) |
time_t | ctime () const PALUDIS_ATTRIBUTE((warn_unused_result)) |
time_t | mtime () const PALUDIS_ATTRIBUTE((warn_unused_result)) |
off_t | file_size () const PALUDIS_ATTRIBUTE((warn_unused_result)) |
uid_t | owner () const PALUDIS_ATTRIBUTE((warn_unused_result)) |
gid_t | group () const PALUDIS_ATTRIBUTE((warn_unused_result)) |
std::pair< dev_t, ino_t > | lowlevel_id () const PALUDIS_ATTRIBUTE((warn_unused_result)) |
static FSEntry | cwd () PALUDIS_ATTRIBUTE((warn_unused_result)) |
Filesystem operations | |
bool | mkdir (const mode_t mode=0755) |
bool | symlink (const std::string &target) |
bool | unlink () |
bool | rmdir () |
bool | utime (const struct::utimbuf *buf=0) |
void | chown (const uid_t owner, const gid_t group=static_cast< gid_t >(-1)) |
void | lchown (const uid_t owner, const gid_t group=static_cast< gid_t >(-1)) |
void | chmod (const mode_t mode) |
void | rename (const FSEntry &new_name) |
Public Member Functions | |
std::string | basename () const PALUDIS_ATTRIBUTE((warn_unused_result)) |
FSEntry | strip_leading (const FSEntry &prefix) const |
FSEntry | dirname () const PALUDIS_ATTRIBUTE((warn_unused_result)) |
Friends | |
class | DirIterator |
std::ostream & | operator<< (std::ostream &s, const FSEntry &f) |
const FSEntry& paludis::FSEntry::operator/= | ( | const std::string & | rhs | ) | [inline] |
Append another path.
FSEntry paludis::FSEntry::operator/ | ( | const std::string & | rhs | ) | const |
Join with another path.
std::string paludis::FSEntry::basename | ( | ) | const |
Return the last part of our path (eg '/foo/bar' => 'bar').
Return the path without a given prefix (eg '/foo/bar/baz'->strip_leading('/foo') => '/bar/baz').
FSEntry paludis::FSEntry::dirname | ( | ) | const |
Return the first part of our path (eg '/foo/bar' => '/foo').
bool paludis::FSEntry::exists | ( | ) | const |
Does a filesystem entry exist at our location?
bool paludis::FSEntry::is_directory | ( | ) | const |
Does a filesystem entry exist at our location, and if it does, is it a directory?
bool paludis::FSEntry::is_directory_or_symlink_to_directory | ( | ) | const |
Does a filesystem entry exist at our location, and if it does, is it a directory?
bool paludis::FSEntry::is_regular_file | ( | ) | const |
Does a filesystem entry exist at our location, and if it does, is it a regular file?
bool paludis::FSEntry::is_regular_file_or_symlink_to_regular_file | ( | ) | const |
Does a filesystem entry exist at our location, and if it does, is it a regular file?
bool paludis::FSEntry::is_symbolic_link | ( | ) | const |
Does a filesystem entry exist at our location, and if it does, is it a symbolic link?
bool paludis::FSEntry::is_device | ( | ) | const |
Whether we exist and are a device file.
bool paludis::FSEntry::is_fifo | ( | ) | const |
Whether we exist and are a fifo.
bool paludis::FSEntry::has_permission | ( | const FSUserGroup & | user_group, | |
const FSPermission & | fs_perm | |||
) | const |
Check if filesystem entry has `perm` for `user_group`.
FSError | if there was a problem accessing the filesystem entry |
mode_t paludis::FSEntry::permissions | ( | ) | const |
Return the permissions for our item.
FSError | if there was a problem accessing the filesystem entry |
FSEntry paludis::FSEntry::realpath | ( | ) | const |
Return the canonicalised version of our path.
FSEntry paludis::FSEntry::realpath_if_exists | ( | ) | const |
Return the canonicalised version of our path, if it exists, or ourself if it doesn't.
std::string paludis::FSEntry::readlink | ( | ) | const |
Return our destination, if we are a symlink.
FSError | if we are not a symlink, or if the system call fails. |
time_t paludis::FSEntry::ctime | ( | ) | const |
Return the time the inode for the filesystem entry was last modified
FSError | if there was a problem accessing the filesystem entry |
time_t paludis::FSEntry::mtime | ( | ) | const |
Return the time the filesystem entry was last modified
FSError | if there was a problem accessing the filesystem entry |
off_t paludis::FSEntry::file_size | ( | ) | const |
uid_t paludis::FSEntry::owner | ( | ) | const |
gid_t paludis::FSEntry::group | ( | ) | const |
static FSEntry paludis::FSEntry::cwd | ( | ) | [static] |
Return the current working directory
std::pair<dev_t, ino_t> paludis::FSEntry::lowlevel_id | ( | ) | const |
Return an unique low-level id for this entry
bool paludis::FSEntry::mkdir | ( | const mode_t | mode = 0755 |
) |
Try to make a directory.
FSError | If an error other than the directory already existing occurs. |
bool paludis::FSEntry::symlink | ( | const std::string & | target | ) |
Try to make a symlink.
FSError | If an error other than the symlink already existing occurs, or if the symlink exists and points elsewhere. |
bool paludis::FSEntry::unlink | ( | ) |
Try to unlink.
FSError | If an error other than us already not existing occurs. |
bool paludis::FSEntry::rmdir | ( | ) |
Try to rmdir.
FSError | If an error other than us already not existing occurs. |
bool paludis::FSEntry::utime | ( | const struct::utimbuf * | buf = 0 |
) |
Try to set atime and mtime
FSError | If an error other than us already not existing ocurrs. |
void paludis::FSEntry::chown | ( | const uid_t | owner, | |
const gid_t | group = static_cast< gid_t >(-1) | |||
) |
void paludis::FSEntry::lchown | ( | const uid_t | owner, | |
const gid_t | group = static_cast< gid_t >(-1) | |||
) |
void paludis::FSEntry::chmod | ( | const mode_t | mode | ) |
void paludis::FSEntry::rename | ( | const FSEntry & | new_name | ) |
std::ostream& operator<< | ( | std::ostream & | s, | |
const FSEntry & | f | |||
) | [friend] |
An FSEntry can be written to an ostream.