old_dir_entry.refresh();
try {
clone_hard_link_or_copy_file(source_path, dest_path, true);
- m_added_raw_files.push_back(dest_path);
+ m_added_raw_files.push_back(AddedRawFile{file_number, dest_path});
} catch (core::Error& e) {
LOG("Failed to store {} as raw file {}: {}",
source_path,
// to rename is OK.
LOG("Moving {} to {}", cache_file_path, wanted_path);
fs::rename(cache_file_path, wanted_path);
- for (const auto& raw_file : m_added_raw_files) {
- fs::rename(raw_file,
- FMT("{}/{}", wanted_path.parent_path(), raw_file.filename()));
+ for (auto [file_number, dest_path] : m_added_raw_files) {
+ fs::rename(dest_path, get_raw_file_path(wanted_path, file_number));
}
}
}
// a statistics file in the finalize method.
core::StatisticsCounters m_counter_updates;
- std::vector<std::filesystem::path> m_added_raw_files;
+ struct AddedRawFile
+ {
+ uint8_t file_number;
+ std::filesystem::path dest_path;
+ };
+ std::vector<AddedRawFile> m_added_raw_files;
bool m_stored_data = false;
struct LookUpCacheFileResult