From 99041b4d84e48b746908b8f0a6cffb32cd1be4a9 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Fri, 28 Mar 2025 13:15:21 -0400 Subject: [PATCH] Fix windows build PR #12767 accidentally broke it. --- src/libstore/local-store.cc | 2 +- src/libutil/file-system.cc | 4 ++-- src/libutil/file-system.hh | 9 ++------- 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/src/libstore/local-store.cc b/src/libstore/local-store.cc index d0ee0bdc1..a9459d098 100644 --- a/src/libstore/local-store.cc +++ b/src/libstore/local-store.cc @@ -115,7 +115,7 @@ LocalStore::LocalStore( state->stmts = std::make_unique(); /* Create missing state directories if they don't already exist. */ - createDirs(realStoreDir); + createDirs(realStoreDir.get()); if (readOnly) { experimentalFeatureSettings.require(Xp::ReadOnlyLocalStore); } else { diff --git a/src/libutil/file-system.cc b/src/libutil/file-system.cc index fe4c9247c..b1a370d7a 100644 --- a/src/libutil/file-system.cc +++ b/src/libutil/file-system.cc @@ -477,12 +477,12 @@ void createDir(const Path & path, mode_t mode) throw SysError("creating directory '%1%'", path); } -void createDirs(const Path & path) +void createDirs(const fs::path & path) { try { fs::create_directories(path); } catch (fs::filesystem_error & e) { - throw SysError("creating directory '%1%'", path); + throw SysError("creating directory '%1%'", path.string()); } } diff --git a/src/libutil/file-system.hh b/src/libutil/file-system.hh index 7970897ee..31dcc5e6b 100644 --- a/src/libutil/file-system.hh +++ b/src/libutil/file-system.hh @@ -231,14 +231,9 @@ void deletePath(const std::filesystem::path & path, uint64_t & bytesFreed); /** * Create a directory and all its parents, if necessary. * - * In the process of being deprecated for - * `std::filesystem::create_directories`. + * Wrapper around `std::filesystem::create_directories` to handle exceptions. */ -void createDirs(const Path & path); -inline void createDirs(PathView path) -{ - return createDirs(Path(path)); -} +void createDirs(const std::filesystem::path & path); /** * Create a single directory.