mirror of
https://github.com/NixOS/nix
synced 2025-07-05 20:41:47 +02:00
fix: handle errors in nix::createDirs
the `std::filesystem::create_directories` can fail due to insufficient permissions. We convert this error into a `SysError` and catch it wherever required.
This commit is contained in:
parent
857e380c7d
commit
85b7989764
3 changed files with 8 additions and 4 deletions
|
@ -415,7 +415,11 @@ void deletePath(const fs::path & path)
|
|||
|
||||
void createDirs(const Path & path)
|
||||
{
|
||||
fs::create_directories(path);
|
||||
try {
|
||||
fs::create_directories(path);
|
||||
} catch (fs::filesystem_error & e) {
|
||||
throw SysError("creating directory '%1%'", path);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue