esp/io/Io.h file

Namespaces

namespace esp
Root namespace.
namespace esp::io

Functions

auto changeExtension(const std::string& file, const std::string& ext) -> std::string
Replaces the extension of the given filename to the given ext.
auto normalizePath(const std::string& srcPath) -> std::string
This function will recursively remove any ellipsis in paths or path patterns, as well as the parent directory the ellisis is bypassing. This is so that if the ellipsis spans an OS link any function consuming the path does not get lost. If the ellipsis is at the beginning of srcPath then it is ignored.
auto getPathRelativeToAbsPath(const std::string& toRelPath, const std::string& absPath) -> std::string
This function will find the relative path of toRelPath relative to absPath.
auto globDirs(const std::string& pattern) -> std::vector<std::string>
This function will perform [glob-based pattern matching] (https://en.wikipedia.org/wiki/Glob_(programming)) to find and return all the files and directories that match the pattern.

Function documentation

std::string changeExtension(const std::string& file, const std::string& ext)

Replaces the extension of the given filename to the given ext.

Parameters
file
ext The extension to change to. If it is not prefixed wtih a dot, one will be added.

std::string normalizePath(const std::string& srcPath)

This function will recursively remove any ellipsis in paths or path patterns, as well as the parent directory the ellisis is bypassing. This is so that if the ellipsis spans an OS link any function consuming the path does not get lost. If the ellipsis is at the beginning of srcPath then it is ignored.

Parameters
srcPath The path to filter
Returns The filtered path.

std::string getPathRelativeToAbsPath(const std::string& toRelPath, const std::string& absPath)

This function will find the relative path of toRelPath relative to absPath.

Parameters
toRelPath The absolute path to be converted to relative
absPath The absolute path the conversion should be relative to
Returns the relative path of toRelPath relative to absPath

std::vector<std::string> globDirs(const std::string& pattern)

This function will perform [glob-based pattern matching] (https://en.wikipedia.org/wiki/Glob_(programming)) to find and return all the files and directories that match the pattern.

Parameters
pattern The pattern to match
Returns a vector of the fully-qualified paths that match the pattern.