eckit::PathName class

Derived classes

class TempFile
class TmpDir
class TmpFile

Public static functions

static auto unique(const PathName&) -> PathName
static void match(const PathName&, std::vector<PathName>&, bool = false)
static void link(const PathName& from, const PathName& to)
static void rename(const PathName& from, const PathName& to)
static void rename(const PathName& from, const std::string& newBase)
static auto shorten(const std::string&) -> std::string
static auto metricsTag(const std::string&) -> std::string

Constructors, destructors, conversion operators

PathName(const char* p = "/", bool tildeIsUserHome = false)
PathName(const std::string& p, bool tildeIsUserHome = false)
PathName(const std::string& type, const std::string& p, bool tildeIsUserHome = false)
PathName(const PathName& p)
PathName(const LocalPathName&)
~PathName()
operator std::string() const

Public functions

auto operator=(const PathName& p) -> PathName&
auto operator=(const std::string& p) -> PathName&
auto operator=(const char* p) -> PathName&
auto asString() const -> std::string
auto localPath() const -> const char*
auto operator+=(const std::string& s) -> PathName&
auto operator+=(const char* s) -> PathName&
auto operator+=(char s) -> PathName&
auto operator/=(const std::string& s) -> PathName&
auto operator/=(const char* s) -> PathName&
auto operator/=(char s) -> PathName&
auto operator<(const PathName& other) const -> bool
auto operator>(const PathName& other) const -> bool
auto operator<=(const PathName& other) const -> bool
auto operator>=(const PathName& other) const -> bool
auto operator!=(const PathName& other) const -> bool
auto operator==(const PathName& other) const -> bool
auto type() const -> const char*
What type of PathName object is this.
auto dirName() const -> PathName
auto fullName() const -> PathName
auto clusterName() const -> PathName
auto baseName(bool ext = true) const -> PathName
auto extension() const -> std::string
auto exists() const -> bool
auto available() const -> bool
auto offsite() const -> bool
Check if path is offsite.
void touch() const
Touch the path. The path leading to it is created if it does not exist.
void reserve(const Length&) const
auto size() const -> Length
auto lastAccess() const -> time_t
auto lastModified() const -> time_t
auto created() const -> time_t
auto owner() const -> uid_t
auto isDir() const -> bool
auto isLink() const -> bool
void empty() const
Clear the file.
void truncate(Length) const
void mkdir(short mode = 0777) const
void chmod(const FileMode& mode) const
void unlink(bool verbose = true) const
Unlink the path.
void rmdir(bool verbose = true) const
Remove the directory.
void syncParentDirectory() const
Synchronise the parent directory entries to persistent storage.
void backup() const
Create a copy with a unique path name.
void copy(const PathName&) const
Create a copy with the given path name.
auto sameAs(const PathName&) const -> bool
auto mountPoint() const -> PathName
auto realName() const -> PathName
auto orphanName() const -> PathName
auto checkClusterNode() const -> PathName
auto node() const -> const std::string&
auto path() const -> const std::string&
void hash(Hash&) const
Hash the contents of this pathname (only valid for files)
auto hash(const std::string& method = "xxh64") const -> std::string
Hash a path as in-place as possible. Returns the hash digest.
void children(std::vector<PathName>& files, std::vector<PathName>& dirs) const
void childrenRecursive(std::vector<PathName>& files, std::vector<PathName>& dirs) const
void fileSystemSize(FileSystemSize&) const
auto fileHandle(bool overwrite = false) const -> DataHandle*
auto partHandle(const OffsetList&, const LengthList&) const -> DataHandle*
auto partHandle(const Offset&, const Length&) const -> DataHandle*

Friends

void operator<<(Stream&, const PathName&)
void operator>>(Stream&, PathName&)
auto operator<<(std::ostream& s, const PathName& p) -> std::ostream&
auto operator+(const PathName& p, const std::string& s) -> PathName
auto operator+(const PathName& p, const char* s) -> PathName
auto operator+(const PathName& p, char s) -> PathName
auto operator/(const PathName& p, const std::string& s) -> PathName
auto operator/(const PathName& p, const char* s) -> PathName
auto operator/(const PathName& p, char s) -> PathName

Function documentation

PathName eckit::PathName::dirName() const

Returns directory part of the path

Directory part of the path

PathName eckit::PathName::fullName() const

Returns absolute path

Absolute path

PathName eckit::PathName::baseName(bool ext = true) const

Parameters
ext if false the extension is stripped
Returns the name part of the path

Base name of the path

std::string eckit::PathName::extension() const

Returns file extension (empty string if there is none)

path extension

bool eckit::PathName::exists() const

Returns true if the path exists

Check if path exists

bool eckit::PathName::available() const

Returns true (local paths are always available)

Check if path is available

void eckit::PathName::reserve(const Length&) const

Reserve a given number of Bytes (file must be of length 0 or not exist)

Length eckit::PathName::size() const

Returns Size in Bytes

File size

time_t eckit::PathName::lastAccess() const

Returns Time of last access

Last access time

time_t eckit::PathName::lastModified() const

Returns Time of last modification

Last modification time

time_t eckit::PathName::created() const

Returns Time of creation

Creation time

uid_t eckit::PathName::owner() const

Returns Owner ID

File owner

bool eckit::PathName::isDir() const

Returns true if the path is a directory

Check if path is a directory

bool eckit::PathName::isLink() const

Returns true if the path is a symlink

Check if path is a symlink

void eckit::PathName::truncate(Length) const

Truncate the file to given number of Bytes.

void eckit::PathName::mkdir(short mode = 0777) const

Parameters
mode file mode bits

Create the directory and all directories leading to it with given mode

void eckit::PathName::chmod(const FileMode& mode) const

Parameters
mode file mode bits

Change the file mode

bool eckit::PathName::sameAs(const PathName&) const

Returns true if the path points to the same inode as the given path

Check if a given path points to the same inode as this path

PathName eckit::PathName::mountPoint() const

Returns mount point of path

Mount point of the path

PathName eckit::PathName::realName() const

Returns the real path (with symlinks resolved)

Real path (with symlinks resolved)

const std::string& eckit::PathName::path() const

Returns string representation of path

String representation

void eckit::PathName::children(std::vector<PathName>& files, std::vector<PathName>& dirs) const

Parameters
files vector to be filled with child files of path
dirs

Get child files and directories

void eckit::PathName::childrenRecursive(std::vector<PathName>& files, std::vector<PathName>& dirs) const

Parameters
files vector to be filled with child files of path
dirs

Get child files and directories descending recursively on all sub directories