1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-26 03:21:16 +02:00

Don't change nix::fs for now

This commit is contained in:
Eelco Dolstra 2024-11-12 21:10:01 +01:00
parent 02f0294be0
commit 37f4c71d1c
4 changed files with 9 additions and 3 deletions

View file

@ -29,7 +29,7 @@
namespace nix { namespace nix {
namespace fs = std::filesystem; namespace fs { using namespace std::filesystem; }
/** /**
* Treat the string as possibly an absolute path, by inspecting the * Treat the string as possibly an absolute path, by inspecting the

View file

@ -126,6 +126,8 @@ std::optional<struct stat> maybeLstat(const Path & path);
*/ */
bool pathExists(const Path & path); bool pathExists(const Path & path);
namespace fs {
/** /**
* ``` * ```
* symlink_exists(p) = std::filesystem::exists(std::filesystem::symlink_status(p)) * 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)); return std::filesystem::exists(std::filesystem::symlink_status(path));
} }
} // namespace fs
/** /**
* A version of pathExists that returns false on a permission error. * A version of pathExists that returns false on a permission error.
* Useful for inferring default paths across directories that might not * Useful for inferring default paths across directories that might not

View file

@ -8,7 +8,9 @@
namespace nix { namespace nix {
namespace fs = std::filesystem; namespace fs {
using namespace std::filesystem;
}
namespace { namespace {

View file

@ -77,7 +77,7 @@ struct CmdEval : MixJSON, InstallableValueCommand, MixReadOnlyOption
if (writeTo) { if (writeTo) {
stopProgressBar(); stopProgressBar();
if (nix::symlink_exists(*writeTo)) if (fs::symlink_exists(*writeTo))
throw Error("path '%s' already exists", writeTo->string()); throw Error("path '%s' already exists", writeTo->string());
std::function<void(Value & v, const PosIdx pos, const fs::path & path)> recurse; std::function<void(Value & v, const PosIdx pos, const fs::path & path)> recurse;