More Windows fixes

This commit is contained in:
Marcus Holland-Moritz 2023-06-22 12:16:18 +02:00
parent 1a58fece57
commit 3b602a2984
2 changed files with 10 additions and 4 deletions

View File

@ -81,7 +81,7 @@ struct file_stat {
time_type ctime;
};
template <typename T>
template <bool with_block_info = true, typename T>
void copy_file_stat(T* out, file_stat const& in) {
out->st_dev = in.dev;
out->st_ino = in.ino;
@ -91,8 +91,10 @@ void copy_file_stat(T* out, file_stat const& in) {
out->st_gid = in.gid;
out->st_rdev = in.rdev;
out->st_size = in.size;
out->st_blksize = in.blksize;
out->st_blocks = in.blocks;
if constexpr (with_block_info) {
out->st_blksize = in.blksize;
out->st_blocks = in.blocks;
}
out->st_atime = in.atime;
out->st_mtime = in.mtime;
out->st_ctime = in.ctime;

View File

@ -336,7 +336,11 @@ bool filesystem_extractor_<LoggerPolicy>::extract(
struct stat st;
::memset(&st, 0, sizeof(st));
copy_file_stat(&st, stbuf);
#ifdef _WIN32
copy_file_stat<false>(&st, stbuf);
#else
copy_file_stat<true>(&st, stbuf);
#endif
::archive_entry_set_pathname(ae, entry.path().c_str());
::archive_entry_copy_stat(ae, &st);