mirror of
https://github.com/NixOS/nix.git
synced 2025-12-03 07:31:00 +01:00
libutil: Propagate error code in createSymlink
This commit is contained in:
parent
1cc337bb5f
commit
bf7c53f2d3
1 changed files with 4 additions and 5 deletions
|
|
@ -737,11 +737,10 @@ std::filesystem::path makeTempPath(const std::filesystem::path & root, const std
|
||||||
|
|
||||||
void createSymlink(const Path & target, const Path & link)
|
void createSymlink(const Path & target, const Path & link)
|
||||||
{
|
{
|
||||||
try {
|
std::error_code ec;
|
||||||
std::filesystem::create_symlink(target, link);
|
std::filesystem::create_symlink(target, link, ec);
|
||||||
} catch (std::filesystem::filesystem_error & e) {
|
if (ec)
|
||||||
throw SysError("creating symlink '%1%' -> '%2%'", link, target);
|
throw SysError(ec.value(), "creating symlink '%1%' -> '%2%'", link, target);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void replaceSymlink(const std::filesystem::path & target, const std::filesystem::path & link)
|
void replaceSymlink(const std::filesystem::path & target, const std::filesystem::path & link)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue