paludis  Version 2.6.0
Public Member Functions | Static Public Member Functions | Friends | List of all members
paludis::FSPath Class Reference

Public Member Functions

 FSPath (const std::string &)
 
 FSPath (const FSPath &)
 
FSPathoperator= (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))
 
FSPathoperator/= (const std::string &)
 
FSPathoperator/= (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

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

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

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

Change our permissions.

Exceptions
FSErrorIf the chmod failed.
void paludis::FSPath::chown ( const uid_t  owner,
const gid_t  group 
) const

Change our ownership, following symlinks.

Exceptions
FSErrorIf the chown failed.
static FSPath paludis::FSPath::cwd ( )
static

Return the current working directory

FSPath paludis::FSPath::dirname ( ) const

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

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

Change our ownership, not following symlinks.

Exceptions
FSErrorIf the lchown failed.
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.
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.
FSPath paludis::FSPath::realpath ( ) const

Return the canonicalised version of our path.

FSPath paludis::FSPath::realpath_if_exists ( ) const

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

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

Rename ourself (will not work across mount points).

Exceptions
FSErrorIf the rename failed.
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.
bool paludis::FSPath::starts_with ( const FSPath ) const

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

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').

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.
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.
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.

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