Anklang 0.3.0-460-gc4ef46ba
ASE — Anklang Sound Engine (C++)

« « « Anklang Documentation
Loading...
Searching...
No Matches
Namespaces | Macros | Functions
path.hh File Reference
#include <ase/cxxaux.hh>

Go to the source code of this file.

Namespaces

namespace  Ase
 The Anklang C++ API namespace.
 
namespace  Ase::Path
 The Path namespace provides functions for file path manipulation and testing.
 

Macros

#define ASE_UNIX_PATHS
 Equals 0 on _WIN32 and _WIN64 and 1 on Unix.
 
#define ASE_DOS_PATHS
 Equals 1 on _WIN32 and _WIN64 and 0 on Unix.
 
#define ASE_DIRSEP
 Platform directory separator character, '/' on Unix-like systems, a '\' on _WIN32.
 
#define ASE_DIRSEP2
 Secondary directory separator character, '/' on Unix-like systems.
 
#define ASE_DIRSEPARATORS
 List of platform directory separator characters, "/" on Unix-like systems, "/\\" on _WIN32.
 
#define ASE_SEARCHPATH_SEPARATOR
 Platform searchpath separator, ':' on Unix-like systems, ';' on _WIN32.
 
#define ASE_LIBEXT
 Dynamic library filename extension on this platform.
 
#define ASE_PATH_MAX
 

Functions

String Ase::Path::dirname (const String &path)
 Retrieve the directory part of the filename path.
 
String Ase::Path::basename (const String &path)
 Strips all directory components from path and returns the resulting file name.
 
String Ase::Path::normalize (const String &path)
 Convert path to normal form.
 
String Ase::Path::realpath (const String &path)
 Resolve links and directory references in path and provide a canonicalized absolute pathname.
 
String Ase::Path::dir_terminate (const String &path)
 Append trailing slash to path, unless it's present.
 
String Ase::Path::strip_slashes (const String &path)
 Strip trailing directory terminators.
 
String Ase::Path::abspath (const String &path, const String &incwd)
 
bool Ase::Path::isabs (const String &path)
 Return wether path is an absolute pathname.
 
bool Ase::Path::isroot (const String &path, bool dos_drives)
 Return wether path is an absolute pathname which identifies the root directory.
 
bool Ase::Path::isdirname (const String &path)
 Return wether path is pointing to a directory component.
 
bool Ase::Path::dircontains (const String &dirpath, const String &descendant, String *relpath)
 Check if descendant belongs to the directory hierarchy under dirpath.
 
bool Ase::Path::mkdirs (const String &dirpath, uint mode)
 Create the directories in dirpath with mode, check errno on false returns.
 
void Ase::Path::rmrf (const String &dir)
 Recursively delete directory tree.
 
bool Ase::Path::copy_file (const String &src, const String &dest)
 Copy a file to a new non-existing location, sets errno and returns false on error.
 
bool Ase::Path::rename (const String &src, const String &dest)
 
size_t Ase::Path::file_size (const String &path)
 Retrieve the on-disk size in bytes of path.
 
StringPair Ase::Path::split_extension (const std::string &filepath, const bool lastdot)
 
String Ase::Path::expand_tilde (const String &path)
 Expand a "~/" or "~user/" path which refers to user home directories.
 
String Ase::Path::user_home (const String &username)
 Get a user's home directory, uses $HOME if no username is given.
 
String Ase::Path::xdg_dir (const String &xdgdir)
 
String Ase::Path::data_home ()
 Get the $XDG_DATA_HOME directory, see: https://specifications.freedesktop.org/basedir-spec/latest.
 
String Ase::Path::config_home ()
 Get the $XDG_CONFIG_HOME directory, see: https://specifications.freedesktop.org/basedir-spec/latest.
 
String Ase::Path::config_names ()
 Get config names as set with config_names(), if unset defaults to program_alias().
 
void Ase::Path::config_names (const String &names)
 Set a colon separated list of names for this application to find configuration settings and files.
 
String Ase::Path::cache_home ()
 Get the $XDG_CACHE_HOME directory, see: https://specifications.freedesktop.org/basedir-spec/latest.
 
String Ase::Path::runtime_dir ()
 Get the $XDG_RUNTIME_DIR directory, see: https://specifications.freedesktop.org/basedir-spec/latest.
 
String Ase::Path::config_dirs ()
 Get the $XDG_CONFIG_DIRS directory list, see: https://specifications.freedesktop.org/basedir-spec/latest.
 
String Ase::Path::data_dirs ()
 Get the $XDG_DATA_DIRS directory list, see: https://specifications.freedesktop.org/basedir-spec/latest.
 
String Ase::Path::skip_root (const String &path)
 
template<class ... S>
String Ase::Path::join (String path, const S &...more)
 
bool Ase::Path::check (const String &file, const String &mode)
 
bool Ase::Path::equals (const String &file1, const String &file2)
 
charAse::Path::memread (const String &filename, size_t *lengthp, ssize_t maxlength)
 
void Ase::Path::memfree (char *memread_mem)
 
bool Ase::Path::memwrite (const String &filename, size_t len, const uint8 *bytes, bool append, int perms)
 
String Ase::Path::stringread (const String &filename, ssize_t maxlength)
 
bool Ase::Path::stringwrite (const String &filename, const String &data, bool mkdirs_, int perms)
 
bool Ase::Path::stringappend (const String &filename, const String &data, bool mkdirs_, int perms)
 
String Ase::Path::cwd ()
 Return the current working directoy, including symlinks used in $PWD if available.
 
String Ase::Path::vpath_find (const String &file, const String &mode)
 
String Ase::Path::simplify_abspath (const std::string &abspath_expression)
 Remove extra slashes, './' and '../' from abspath_expression.
 
bool Ase::Path::searchpath_contains (const String &searchpath, const String &element)
 Check if searchpath contains element, a trailing slash searches for directories.
 
String Ase::Path::searchpath_find (const String &searchpath, const String &file, const String &mode)
 Find the first file in searchpath which matches mode (see check()).
 
StringS Ase::Path::searchpath_list (const String &searchpath, const String &mode)
 Find all searchpath entries matching mode (see check()).
 
String Ase::Path::searchpath_multiply (const String &searchpath, const String &postfixes)
 Yield a new searchpath by combining each element of searchpath with each element of postfixes.
 
StringS Ase::Path::searchpath_split (const String &searchpath)
 
String Ase::Path::searchpath_join (const StringS &string_vector)
 
template<class ... S>
String Ase::Path::searchpath_join (String path, const S &...more)
 
void Ase::Path::glob (const String &pathpattern, StringS &matches)
 Create list with filenames matching pathpattern with shell wildcards.
 
void Ase::Path::glob (const String &pathpattern, StringS &dirs, StringS &files)
 Create list with directories and filenames matching pathpattern with shell wildcards.
 
void Ase::Path::rglob (const String &basedir, const String &pattern, StringS &matches)
 Recursively match files with glob pattern under basedir.
 
void Ase::Path::unique_realpaths (StringS &pathnames)
 Convert all pathnames via realpath() and eliminate duplicates.
 
String Ase::Path::join_with (const String &head, char joiner, const String &tail)
 Construct head + joiner + tail avoiding duplicates of joiner.
 

Macro Definition Documentation

◆ ASE_DIRSEP

#define ASE_DIRSEP

Platform directory separator character, '/' on Unix-like systems, a '\' on _WIN32.

Definition at line 18 of file path.hh.

◆ ASE_DIRSEP2

#define ASE_DIRSEP2

Secondary directory separator character, '/' on Unix-like systems.

Definition at line 19 of file path.hh.

◆ ASE_DIRSEPARATORS

#define ASE_DIRSEPARATORS

List of platform directory separator characters, "/" on Unix-like systems, "/\\" on _WIN32.

Definition at line 20 of file path.hh.

◆ ASE_DOS_PATHS

#define ASE_DOS_PATHS

Equals 1 on _WIN32 and _WIN64 and 0 on Unix.

Definition at line 17 of file path.hh.

◆ ASE_LIBEXT

#define ASE_LIBEXT

Dynamic library filename extension on this platform.

Definition at line 22 of file path.hh.

◆ ASE_PATH_MAX

#define ASE_PATH_MAX

Definition at line 24 of file path.hh.

◆ ASE_SEARCHPATH_SEPARATOR

#define ASE_SEARCHPATH_SEPARATOR

Platform searchpath separator, ':' on Unix-like systems, ';' on _WIN32.

Definition at line 21 of file path.hh.

◆ ASE_UNIX_PATHS

#define ASE_UNIX_PATHS

Equals 0 on _WIN32 and _WIN64 and 1 on Unix.

Definition at line 16 of file path.hh.