mirror of
https://github.com/NixOS/nix
synced 2025-06-27 12:41:15 +02:00
symlink_exists: wrap exceptions into nix exception
This commit is contained in:
parent
26b33aa1b0
commit
779687854f
2 changed files with 13 additions and 4 deletions
|
@ -31,7 +31,17 @@
|
|||
|
||||
namespace nix {
|
||||
|
||||
namespace fs { using namespace std::filesystem; }
|
||||
namespace fs {
|
||||
using namespace std::filesystem;
|
||||
|
||||
bool symlink_exists(const std::filesystem::path & path) {
|
||||
try {
|
||||
return std::filesystem::exists(std::filesystem::symlink_status(path));
|
||||
} catch (const std::filesystem::filesystem_error & e) {
|
||||
throw SysError("cannot check existence of %1%", path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool isAbsolute(PathView path)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue