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:
parent
02f0294be0
commit
37f4c71d1c
4 changed files with 9 additions and 3 deletions
|
@ -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
|
||||
|
|
|
@ -126,6 +126,8 @@ std::optional<struct stat> 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
|
||||
|
|
|
@ -8,7 +8,9 @@
|
|||
|
||||
namespace nix {
|
||||
|
||||
namespace fs = std::filesystem;
|
||||
namespace fs {
|
||||
using namespace std::filesystem;
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
|
|
|
@ -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<void(Value & v, const PosIdx pos, const fs::path & path)> recurse;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue