paludis Version 3.0.2
The one true package mangler
paludis::FSPath Class Reference

Public Member Functions

 FSPath (const std::string &)
 FSPath (const FSPath &)
FSPath & operator= (const FSPath &)
FSStat stat () const PALUDIS_ATTRIBUTE((warn_unused_result))
FSPath operator/ (const std::string &) const PALUDIS_ATTRIBUTE((warn_unused_result))
FSPath operator/ (const FSPath &) const PALUDIS_ATTRIBUTE((warn_unused_result))
FSPath & operator/= (const std::string &)
FSPath & operator/= (const FSPath &)
const std::string basename () const PALUDIS_ATTRIBUTE((warn_unused_result))
FSPath dirname () const PALUDIS_ATTRIBUTE((warn_unused_result))
FSPath realpath () const PALUDIS_ATTRIBUTE((warn_unused_result))
FSPath realpath_if_exists () const PALUDIS_ATTRIBUTE((warn_unused_result))
FSPath strip_leading (const FSPath &prefix) const
bool starts_with (const FSPath &) const
bool mkdir (const mode_t mode, const FSPathMkdirOptions &) const
bool symlink (const std::string &target) const
bool unlink () const
bool rmdir () const
void chown (const uid_t owner, const gid_t group) const
void lchown (const uid_t owner, const gid_t group) const
void chmod (const mode_t mode) const
bool utime (const Timestamp &) const
std::string readlink () const PALUDIS_ATTRIBUTE((warn_unused_result))
void rename (const FSPath &new_name) const

Static Public Member Functions

static FSPath cwd () PALUDIS_ATTRIBUTE((warn_unused_result))

Friends

std::ostream & paludis::operator<< (std::ostream &s, const FSPath &f)
bool operator== (const FSPath &, const FSPath &)

Member Function Documentation

◆ basename()

const std::string paludis::FSPath::basename ( ) const

Return the last part of our path (eg '/foo/bar' => 'bar').

References PALUDIS_ATTRIBUTE.

◆ chmod()

void paludis::FSPath::chmod ( const mode_t mode) const

Change our permissions.

Exceptions
FSErrorIf the chmod failed.

References chmod().

Referenced by chmod().

◆ chown()

void paludis::FSPath::chown ( const uid_t owner,
const gid_t group ) const

Change our ownership, following symlinks.

Exceptions
FSErrorIf the chown failed.

References chown().

Referenced by chown().

◆ cwd()

FSPath paludis::FSPath::cwd ( )
static

Return the current working directory

References cwd(), and PALUDIS_ATTRIBUTE.

Referenced by cwd().

◆ dirname()

FSPath paludis::FSPath::dirname ( ) const

Return the first part of our path (eg '/foo/bar' => '/foo').

References dirname(), and PALUDIS_ATTRIBUTE.

Referenced by dirname().

◆ lchown()

void paludis::FSPath::lchown ( const uid_t owner,
const gid_t group ) const

Change our ownership, not following symlinks.

Exceptions
FSErrorIf the lchown failed.

References lchown().

Referenced by lchown().

◆ mkdir()

bool paludis::FSPath::mkdir ( const mode_t mode,
const FSPathMkdirOptions &  ) const

Try to make a directory.

Returns
True, if we succeeded, and false if the directory already exists and is a directory and options includes fspmkdo_ok_if_exists.
Exceptions
FSErrorIf an error other than the directory already existing occurs, or if the directory already exists and options does not include fspmkdo_ok_if_exists.

References mkdir().

Referenced by mkdir().

◆ readlink()

std::string paludis::FSPath::readlink ( ) const

Return our destination, if we are a symlink.

Exceptions
FSErrorif we are not a symlink, or if the system call fails.

References PALUDIS_ATTRIBUTE, and readlink().

Referenced by readlink().

◆ realpath()

FSPath paludis::FSPath::realpath ( ) const

Return the canonicalised version of our path.

References PALUDIS_ATTRIBUTE, and realpath().

Referenced by realpath().

◆ realpath_if_exists()

FSPath paludis::FSPath::realpath_if_exists ( ) const

Return the canonicalised version of our path, if it exists, or ourself if it doesn't.

References PALUDIS_ATTRIBUTE, and realpath_if_exists().

Referenced by realpath_if_exists().

◆ rename()

void paludis::FSPath::rename ( const FSPath & new_name) const

Rename ourself (will not work across mount points).

Exceptions
FSErrorIf the rename failed.

References rename().

Referenced by rename().

◆ rmdir()

bool paludis::FSPath::rmdir ( ) const

Try to rmdir.

Returns
True, if we succeeded, and false if we don't exist already.
Exceptions
FSErrorIf an error other than us already not existing occurs.

References rmdir().

Referenced by rmdir().

◆ starts_with()

bool paludis::FSPath::starts_with ( const FSPath & ) const

Do we start with a given path (eg '/foo/bar' starts with '/foo' but not '/fo')?

References starts_with().

Referenced by starts_with().

◆ strip_leading()

FSPath paludis::FSPath::strip_leading ( const FSPath & prefix) const

Return the path without a given prefix (eg '/foo/bar/baz'->strip_leading('/foo') => '/bar/baz').

References strip_leading().

Referenced by strip_leading().

◆ symlink()

bool paludis::FSPath::symlink ( const std::string & target) const

Try to make a symlink.

Returns
True, if we succeeded, and false if the target already exists and is a symlink to the same target.
Exceptions
FSErrorIf an error other than the symlink already existing occurs, or if the symlink exists and points elsewhere.

References symlink().

Referenced by symlink().

◆ unlink()

bool paludis::FSPath::unlink ( ) const

Try to unlink.

Returns
True, if we succeeded, and false if we don't exist already.
Exceptions
FSErrorIf an error other than us already not existing occurs.

References unlink().

Referenced by unlink().

◆ utime()

bool paludis::FSPath::utime ( const Timestamp & ) const

Try to set atime and mtime

Returns
True, if we succeeded, and false if we don't exist already.
Exceptions
FSErrorIf an error other than us already not existing ocurrs.

References utime().

Referenced by utime().


The documentation for this class was generated from the following file: