class
#include <eckit/filesystem/LocalPathName.h>
LocalPathName LocalPathName represents a UNIX path.
Public static functions
- static auto type() -> const char*
- static auto unique(const LocalPathName&) -> LocalPathName
-
static void match(const LocalPathName&,
std::
vector<LocalPathName>&, bool recursive = false) - static void link(const LocalPathName& from, const LocalPathName& to)
- static void rename(const LocalPathName& from, const LocalPathName& to)
-
static void rename(const LocalPathName& from,
const std::
string& newBase) - static auto cwd() -> LocalPathName
Constructors, destructors, conversion operators
- LocalPathName(const char* p = "/", bool tildeIsUserHome = false, bool skipTildeExpansion = false)
-
LocalPathName(const std::
string& p, bool tildeIsUserHome = false, bool skipTildeExpansion = false) - LocalPathName(const LocalPathName& p)
- operator const std::string&() const
Public functions
- auto operator=(const LocalPathName& p) -> LocalPathName&
-
auto operator=(const std::
string& p) -> LocalPathName& - auto operator=(const char* p) -> LocalPathName&
- auto localPath() const -> const char*
- auto c_str() const -> const char*
-
auto operator+=(const std::
string& s) -> LocalPathName& - auto operator+=(const char* s) -> LocalPathName&
- auto operator+=(char s) -> LocalPathName&
- auto operator<(const LocalPathName& other) const -> bool
- auto operator>(const LocalPathName& other) const -> bool
- auto operator<=(const LocalPathName& other) const -> bool
- auto operator>=(const LocalPathName& other) const -> bool
- auto operator!=(const LocalPathName& other) const -> bool
- auto operator==(const LocalPathName& other) const -> bool
- auto relativePath(const LocalPathName& other) const -> LocalPathName
- auto dirName() const -> LocalPathName
- auto fullName() const -> LocalPathName
- auto orphanName() const -> LocalPathName
- auto checkClusterNode() const -> BasePathName*
-
auto clusterName() const -> std::
string - auto baseName(bool ext = true) const -> LocalPathName
-
auto extension() const -> std::
string -
auto hash(const std::
string& method = "xxh64") const -> std:: string - auto exists() const -> bool
- auto available() const -> bool
- auto offsite() const -> bool
- 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 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(short mode) const
- void unlink(bool verbose = true) const
- Unlink the path.
- void rmdir(bool verbose = true) const
- Remove the directory.
- void backup() const
- Create a copy with a unique path name.
- void copy(const LocalPathName&) const
- Create a copy with the given path name.
- auto sameAs(const LocalPathName&) const -> bool
- auto mountPoint() const -> LocalPathName
- auto realName() const -> LocalPathName
-
void children(std::
vector<LocalPathName>& files, std:: vector<LocalPathName>& dirs) const -
auto node() const -> const std::
string& -
auto path() const -> const std::
string& - void fileSystemSize(FileSystemSize&) const
- auto fileHandle(bool overwrite) const -> DataHandle*
- auto partHandle(const OffsetList&, const LengthList&) const -> DataHandle*
- auto partHandle(const Offset&, const Length&) const -> DataHandle*
- void syncParentDirectory() const
Friends
- void operator<<(Stream&, const LocalPathName&)
- void operator>>(Stream&, LocalPathName&)
-
auto operator<<(std::
ostream& s, const LocalPathName& p) -> std:: ostream& -
auto operator+(const LocalPathName& p,
const std::
string& s) -> LocalPathName - auto operator+(const LocalPathName& p, const char* s) -> LocalPathName
- auto operator+(const LocalPathName& p, char s) -> LocalPathName
Function documentation
LocalPathName eckit:: LocalPathName:: relativePath(const LocalPathName& other) const
Returns | a relative filepath to path to a start directory. This is a pure path computation, no filesystem is accessed to confirm the existence or nature of path |
---|
LocalPathName eckit:: LocalPathName:: dirName() const
Returns | directory part of the path |
---|
Directory part of the path
LocalPathName eckit:: LocalPathName:: 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:: LocalPathName:: extension() const
Returns | file extension (empty string if there is none) |
---|
File extension
std:: string eckit:: LocalPathName:: hash(const std:: string& method = "xxh64") const
Parameters | |
---|---|
method | - specifies the hash method to use (default xxHash) |
Returns | the hash digest |
Return the hash digest of the file
bool eckit:: LocalPathName:: available() const
Returns | true (local paths are always available) |
---|
Check if path is available
bool eckit:: LocalPathName:: offsite() const
Returns | true (local paths are always available) |
---|
Check if path is offsite
time_t eckit:: LocalPathName:: lastModified() const
Returns | Time of last modification |
---|
Last modification time
bool eckit:: LocalPathName:: isDir() const
Returns | true if the path is a directory |
---|
Check if path is a directory
bool eckit:: LocalPathName:: isLink() const
Returns | true if the path is a symlink |
---|
Check if path is a symlink
void eckit:: LocalPathName:: mkdir(short mode = 0777) const
Parameters | |
---|---|
mode | file mode bits |
Create the directory and all directories leading to it with given mode
void eckit:: LocalPathName:: chmod(short mode) const
Parameters | |
---|---|
mode | file mode bits |
Change the file mode
bool eckit:: LocalPathName:: sameAs(const LocalPathName&) 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
LocalPathName eckit:: LocalPathName:: mountPoint() const
Returns | mount point of path |
---|
Mount point of the path
LocalPathName eckit:: LocalPathName:: realName() const
Returns | the real path (with symlinks resolved) |
---|
Real path (with symlinks resolved)
void eckit:: LocalPathName:: children(std:: vector<LocalPathName>& files,
std:: vector<LocalPathName>& dirs) const
Parameters | |
---|---|
files | vector to be filled with child files of path |
dirs |
Get child files and directories
const std:: string& eckit:: LocalPathName:: path() const
Returns | string representation of path |
---|
String representation