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