diff options
author | Qyriad <qyriad@qyriad.me> | 2024-07-12 16:15:33 -0600 |
---|---|---|
committer | Qyriad <qyriad@qyriad.me> | 2024-07-15 15:26:53 -0600 |
commit | d9c51ec4e5919245dcc5e9f2f5532f4d85be5218 (patch) | |
tree | 4727d01f8fdffb5dd411645135637c91478f04a3 /src/libutil/file-system.hh | |
parent | 1eb5d22132a57487e0cb84a65ecd35814624c0e5 (diff) |
libutil: implement a realPath() utility
Just a wrapper around POSIX realpath().
Change-Id: I2593770285dbae573eace490efce5b272b00b001
Diffstat (limited to 'src/libutil/file-system.hh')
-rw-r--r-- | src/libutil/file-system.hh | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/libutil/file-system.hh b/src/libutil/file-system.hh index 636c13f13..e49323e84 100644 --- a/src/libutil/file-system.hh +++ b/src/libutil/file-system.hh @@ -47,6 +47,22 @@ Path absPath(Path path, Path canonPath(PathView path, bool resolveSymlinks = false); /** + * Resolves a file path to a fully absolute path with no symbolic links. + * + * @param path The path to resolve. If it is relative, it will be resolved relative + * to the process's current directory. + * + * @note This is not a pure function; it performs this resolution by querying + * the filesystem. + * + * @note @ref path sadly must be (a reference to) an owned string, as std::string_view + * are not valid C strings... + * + * @return The fully resolved path. + */ +Path realPath(Path const & path); + +/** * Change the permissions of a path * Not called `chmod` as it shadows and could be confused with * `int chmod(char *, mode_t)`, which does not handle errors |