Typedefs | |
using | StringStringM = std::map< String, String > |
Functions | |
String | abspath (const String &path, const String &incwd) |
String | basename (const String &path) |
String | cache_home () |
bool | check (const String &file, const String &mode) |
String | config_dirs () |
String | config_home () |
String | config_names () |
void | config_names (const String &names) |
bool | copy_file (const String &src, const String &dest) |
String | cwd () |
String | data_dirs () |
String | data_home () |
String | dir_terminate (const String &path) |
bool | dircontains (const String &dirpath, const String &descendant, String *relpath) |
String | dirname (const String &path) |
bool | equals (const String &file1, const String &file2) |
String | expand_tilde (const String &path) |
size_t | file_size (const String &path) |
void | glob (const String &pathpattern, StringS &dirs, StringS &files) |
void | glob (const String &pathpattern, StringS &matches) |
bool | isabs (const String &path) |
bool | isdirname (const String &path) |
bool | isroot (const String &path, bool dos_drives) |
template<class ... S> | |
String | join (String path, const S &...more) |
String | join_with (const String &head, char joiner, const String &tail) |
void | memfree (char *memread_mem) |
char * | memread (const String &filename, size_t *lengthp, ssize_t maxlength) |
bool | memwrite (const String &filename, size_t len, const uint8 *bytes, bool append) |
bool | mkdirs (const String &dirpath, uint mode) |
String | normalize (const String &path) |
String | realpath (const String &path) |
bool | rename (const String &src, const String &dest) |
void | rglob (const String &basedir, const String &pattern, StringS &matches) |
void | rmrf (const String &dir) |
String | runtime_dir () |
bool | searchpath_contains (const String &searchpath, const String &element) |
String | searchpath_find (const String &searchpath, const String &file, const String &mode) |
String | searchpath_join (const StringS &string_vector) |
template<class ... S> | |
String | searchpath_join (String path, const S &...more) |
StringS | searchpath_list (const String &searchpath, const String &mode) |
String | searchpath_multiply (const String &searchpath, const String &postfixes) |
StringS | searchpath_split (const String &searchpath) |
String | simplify_abspath (const std::string &abspath_expression) |
String | skip_root (const String &path) |
StringPair | split_extension (const std::string &filepath, const bool lastdot) |
bool | stringappend (const String &filename, const String &data, bool mkdirs_) |
String | stringread (const String &filename, ssize_t maxlength) |
bool | stringwrite (const String &filename, const String &data, bool mkdirs_) |
String | strip_slashes (const String &path) |
void | unique_realpaths (StringS &pathnames) |
String | user_home (const String &username) |
String | vpath_find (const String &file, const String &mode) |
String | xdg_dir (const String &xdgdir) |
The Path namespace provides functions for file path manipulation and testing.
using StringStringM = std::map<String,String> |
Strips all directory components from path and returns the resulting file name.
Resolve links and directory references in path and provide a canonicalized absolute pathname.
path | a filename path |
incwd | optional current working directory |
Complete path to become an absolute file path. If neccessary, incwd or the real current working directory is prepended.
bool isabs | ( | const String & | path | ) |
Return wether path is an absolute pathname.
bool isroot | ( | const String & | path, |
bool | dos_drives | ||
) |
Return wether path is an absolute pathname which identifies the root directory.
bool isdirname | ( | const String & | path | ) |
Return wether path is pointing to a directory component.
Create the directories in `dirpath` with `mode`, check errno on false returns.
Check if `descendant` belongs to the directory hierarchy under `dirpath`.
void rmrf | ( | const String & | dir | ) |
Recursively delete directory tree.
Copy a file to a new non-existing location, sets errno and returns false on error.
Get a user's home directory, uses $HOME if no username is given.
String data_home | ( | ) |
Get the $XDG_DATA_HOME directory, see: https://specifications.freedesktop.org/basedir-spec/latest.
String config_home | ( | ) |
Get the $XDG_CONFIG_HOME directory, see: https://specifications.freedesktop.org/basedir-spec/latest.
String cache_home | ( | ) |
Get the $XDG_CACHE_HOME directory, see: https://specifications.freedesktop.org/basedir-spec/latest.
String runtime_dir | ( | ) |
Get the $XDG_RUNTIME_DIR directory, see: https://specifications.freedesktop.org/basedir-spec/latest.
String config_dirs | ( | ) |
Get the $XDG_CONFIG_DIRS directory list, see: https://specifications.freedesktop.org/basedir-spec/latest.
String data_dirs | ( | ) |
Get the $XDG_DATA_DIRS directory list, see: https://specifications.freedesktop.org/basedir-spec/latest.
String config_names | ( | ) |
Get config names as set with config_names(), if unset defaults to program_alias().
void config_names | ( | const String & | names | ) |
Set a colon separated list of names for this application to find configuration settings and files.
StringPair split_extension | ( | const std::string & | filepath, |
const bool | lastdot | ||
) |
Expand a "~/" or "~user/" path which refers to user home directories.
size_t file_size | ( | const String & | path | ) |
Retrieve the on-disk size in bytes of `path`.
file | possibly relative filename |
mode | feature string |
Perform various checks on file and return whether all checks passed. On failure, errno is set appropriately, and FALSE is returned. Available features to be checked for are:
e
- file must exist r
- file must be readable w
- file must be writable x
- file must be executable f
- file must be a regular file d
- file must be a directory l
- file must be a symbolic link c
- file must be a character device b
- file must be a block device p
- file must be a named pipe s
- file must be a socket. file1 | possibly relative filename |
file2 | possibly relative filename |
Check whether file1 and file2 are pointing to the same inode in the same file system on the same device.
String cwd | ( | ) |
Return the current working directoy, including symlinks used in $PWD if available.
Check if searchpath contains element, a trailing slash searches for directories.
Find the first file in searchpath which matches mode (see check()).
Find all searchpath entries matching mode (see check()).
Construct `head + joiner + tail` avoiding duplicates of `joiner`.
Yield a new searchpath by combining each element of searchpath with each element of postfixes.
Create list with directories and filenames matching `pathpattern` with shell wildcards.
Create list with filenames matching `pathpattern` with shell wildcards.
Recursively match files with glob `pattern` under `basedir`.
void unique_realpaths | ( | StringS & | pathnames | ) |
Convert all `pathnames` via realpath() and eliminate duplicates.
String simplify_abspath | ( | const std::string & | abspath_expression | ) |
Remove extra slashes, './' and '../' from `abspath_expression`.
char * memread | ( | const String & | filename, |
size_t * | lengthp, | ||
ssize_t | maxlength | ||
) |
void memfree | ( | char * | memread_mem | ) |