Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/libstore/local-binary-cache-store.cc
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,11 @@ struct LocalBinaryCacheStore : virtual BinaryCacheStore
void upsertFile(
const std::string & path, RestartableSource & source, const std::string & mimeType, uint64_t sizeHint) override
{
auto path2 = config->binaryCacheDir + "/" + path;
auto path2 = std::filesystem::path{config->binaryCacheDir} / path;
static std::atomic<int> counter{0};
Path tmp = fmt("%s.tmp.%d.%d", path2, getpid(), ++counter);
createDirs(path2.parent_path());
auto tmp = path2;
tmp += fmt(".tmp.%d.%d", getpid(), ++counter);
AutoDelete del(tmp, false);
writeFile(tmp, source);
std::filesystem::rename(tmp, path2);
Expand Down
Loading