wibble 1.1
Classes | Namespaces | Functions
fs.h File Reference
#include <string>
#include <iosfwd>
#include <memory>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
Include dependency graph for fs.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  wibble::sys::fs::Directory
 Nicely wrap access to directories. More...
 
class  wibble::sys::fs::Directory::const_iterator
 

Namespaces

namespace  wibble
 
namespace  wibble::sys
 
namespace  wibble::sys::fs
 

Functions

std::auto_ptr< struct stat > wibble::sys::fs::stat (const std::string &pathname)
 stat() the given file and return the struct stat with the results.
 
void wibble::sys::fs::stat (const std::string &pathname, struct stat &st)
 stat() the given file filling in the given structure.
 
bool wibble::sys::fs::access (const std::string &s, int m)
 access() a filename
 
bool wibble::sys::fs::exists (const std::string &s)
 Same as access(s, F_OK);.
 
std::string wibble::sys::fs::abspath (const std::string &pathname)
 Get the absolute path of a file.
 
std::string wibble::sys::fs::mkdtemp (std::string templ)
 
void wibble::sys::fs::mkdirIfMissing (const std::string &dir, mode_t mode=0777)
 Create the given directory, if it does not already exists.
 
void wibble::sys::fs::mkpath (const std::string &dir)
 Create all the component of the given directory, including the directory itself.
 
void wibble::sys::fs::mkFilePath (const std::string &file)
 Ensure that the path to the given file exists, creating it if it does not.
 
std::string wibble::sys::fs::readFile (const std::string &file)
 Read whole file into memory. Throws exceptions on failure.
 
std::string wibble::sys::fs::readFile (std::istream &file, const std::string &filename)
 Read the entire contents of a file into a string.
 
void wibble::sys::fs::writeFile (const std::string &file, const std::string &data)
 Write data to file, replacing existing contents if it already exists.
 
void wibble::sys::fs::writeFileAtomically (const std::string &file, const std::string &data)
 Write data to file, replacing existing contents if it already exists.
 
std::string wibble::sys::fs::findExecutable (const std::string &name)
 Compute the absolute path of an executable.
 
bool wibble::sys::fs::deleteIfExists (const std::string &file)
 Delete a file if it exists.
 
void wibble::sys::fs::renameIfExists (const std::string &src, const std::string &dst)
 Move src to dst, without raising exception if src does not exist.
 
void wibble::sys::fs::unlink (const std::string &fname)
 Delete the file.
 
void wibble::sys::fs::rmdir (const std::string &dirname)
 Remove the directory using rmdir(2)
 
void wibble::sys::fs::rmtree (const std::string &dir)
 Delete the directory dir and all its content.
 
bool wibble::sys::fs::isdir (const std::string &pathname)
 Returns true if the given pathname is a directory, else false.
 
bool wibble::sys::fs::isblk (const std::string &pathname)
 Same as isdir but checks for block devices.
 
bool wibble::sys::fs::ischr (const std::string &pathname)
 Same as isdir but checks for character devices.
 
bool wibble::sys::fs::isfifo (const std::string &pathname)
 Same as isdir but checks for FIFOs.
 
bool wibble::sys::fs::islnk (const std::string &pathname)
 Same as isdir but checks for symbolic links.
 
bool wibble::sys::fs::isreg (const std::string &pathname)
 Same as isdir but checks for regular files.
 
bool wibble::sys::fs::issock (const std::string &pathname)
 Same as isdir but checks for sockets.
 
time_t wibble::sys::fs::timestamp (const std::string &file)
 File mtime.
 
time_t wibble::sys::fs::timestamp (const std::string &file, time_t def)
 File mtime (or def if the file does not exist)
 
size_t wibble::sys::fs::size (const std::string &file)
 File size.
 
size_t wibble::sys::fs::size (const std::string &file, size_t def)
 File size (or def if the file does not exist)
 
ino_t wibble::sys::fs::inode (const std::string &file)
 File inode number.
 
ino_t wibble::sys::fs::inode (const std::string &file, ino_t def)
 File inode number (or 0 if the file does not exist)