diff --git a/src/libutil/file-system.cc b/src/libutil/file-system.cc index 2802bbf98..92996ea47 100644 --- a/src/libutil/file-system.cc +++ b/src/libutil/file-system.cc @@ -29,7 +29,7 @@ namespace nix { -namespace fs = std::filesystem; +namespace fs { using namespace std::filesystem; } /** * Treat the string as possibly an absolute path, by inspecting the diff --git a/src/libutil/file-system.hh b/src/libutil/file-system.hh index da864d500..4c08cdf58 100644 --- a/src/libutil/file-system.hh +++ b/src/libutil/file-system.hh @@ -126,6 +126,8 @@ std::optional maybeLstat(const Path & path); */ bool pathExists(const Path & path); +namespace fs { + /** * ``` * symlink_exists(p) = std::filesystem::exists(std::filesystem::symlink_status(p)) @@ -139,6 +141,8 @@ inline bool symlink_exists(const std::filesystem::path & path) { return std::filesystem::exists(std::filesystem::symlink_status(path)); } +} // namespace fs + /** * A version of pathExists that returns false on a permission error. * Useful for inferring default paths across directories that might not diff --git a/src/libutil/tarfile.cc b/src/libutil/tarfile.cc index 397169757..e412930bb 100644 --- a/src/libutil/tarfile.cc +++ b/src/libutil/tarfile.cc @@ -8,7 +8,9 @@ namespace nix { -namespace fs = std::filesystem; +namespace fs { +using namespace std::filesystem; +} namespace { diff --git a/src/nix/eval.cc b/src/nix/eval.cc index a8c18fef6..7811b77ed 100644 --- a/src/nix/eval.cc +++ b/src/nix/eval.cc @@ -77,7 +77,7 @@ struct CmdEval : MixJSON, InstallableValueCommand, MixReadOnlyOption if (writeTo) { stopProgressBar(); - if (nix::symlink_exists(*writeTo)) + if (fs::symlink_exists(*writeTo)) throw Error("path '%s' already exists", writeTo->string()); std::function recurse;