diff options
Diffstat (limited to 'src/libutil/file-system.hh')
-rw-r--r-- | src/libutil/file-system.hh | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/libutil/file-system.hh b/src/libutil/file-system.hh index e49323e84..0a54d1a3b 100644 --- a/src/libutil/file-system.hh +++ b/src/libutil/file-system.hh @@ -63,6 +63,16 @@ Path canonPath(PathView path, bool resolveSymlinks = false); Path realPath(Path const & path); /** + * Resolve a tilde path like `~/puppy.nix` into an absolute path. + * + * If `home` is given, it's substituted for `~/` at the start of the input + * `path`. Otherwise, an error is thrown. + * + * If the path starts with `~` but not `~/`, an error is thrown. + */ +Path tildePath(Path const & path, const std::optional<Path> & home = std::nullopt); + +/** * 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 |