1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-12-15 13:31:05 +01:00

Merge pull request #14676 from NixOS/fs-fixes

libstore: Use makeTempPath in optimizePath_, assorted fs fixes
This commit is contained in:
John Ericson 2025-12-01 01:55:20 +00:00 committed by GitHub
commit 1e9b1ff851
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 15 additions and 8 deletions

View file

@ -737,11 +737,10 @@ std::filesystem::path makeTempPath(const std::filesystem::path & root, const std
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)

View file

@ -294,6 +294,10 @@ class AutoDelete
public:
AutoDelete();
AutoDelete(const std::filesystem::path & p, bool recursive = true);
AutoDelete(AutoDelete &&) = delete;
AutoDelete(const AutoDelete &) = delete;
AutoDelete & operator=(AutoDelete &&) = delete;
AutoDelete & operator=(const AutoDelete &) = delete;
~AutoDelete();
void cancel();