Fix slicing warning in tar_object::save_directory

This commit is contained in:
Megamouse 2026-05-30 18:34:57 +02:00
parent eafa6a9a25
commit 8c82ce8bed

View File

@ -606,7 +606,7 @@ void tar_object::save_directory(const std::string& target_path, utils::serial& a
ar.breathe(); ar.breathe();
}; };
fs::stat_t stat{}; fs::dir_entry stat{};
if (src_dir_pos == umax) if (src_dir_pos == umax)
{ {
@ -642,14 +642,14 @@ void tar_object::save_directory(const std::string& target_path, utils::serial& a
// Optimization: avoid saving to list if this is not an evaluation call // Optimization: avoid saving to list if this is not an evaluation call
if (is_null) if (is_null)
{ {
static_cast<fs::stat_t&>(entries.emplace_back()) = stat; entries.push_back(stat);
entries.back().name = target_path; entries.back().name = target_path;
} }
} }
else else
{ {
stat = entries.back(); stat = entries.back();
save_header(stat, entries.back().name); save_header(stat, stat.name);
} }
if (stat.is_directory) if (stat.is_directory)
@ -694,11 +694,7 @@ void tar_object::save_directory(const std::string& target_path, utils::serial& a
} }
else else
{ {
fs::dir_entry entry{}; save_file(stat, target_path);
entry.name = target_path;
static_cast<fs::stat_t&>(entry) = stat;
save_file(entry, entry.name);
} }
ar.breathe(); ar.breathe();