mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
[FileTools] Maintain datestamp on extract
This commit is contained in:
@@ -416,7 +416,11 @@ namespace SabreTools.Helper
|
|||||||
Directory.CreateDirectory(tempDir);
|
Directory.CreateDirectory(tempDir);
|
||||||
|
|
||||||
// Extract all files to the temp directory
|
// Extract all files to the temp directory
|
||||||
sza.WriteToDirectory(tempDir, ExtractOptions.ExtractFullPath | ExtractOptions.Overwrite);
|
foreach (IArchiveEntry iae in sza.Entries)
|
||||||
|
{
|
||||||
|
iae.WriteToDirectory(tempDir, ExtractOptions.ExtractFullPath | ExtractOptions.Overwrite);
|
||||||
|
File.SetLastWriteTime(Path.Combine(tempDir, iae.Key), (DateTime)iae.LastModifiedTime);
|
||||||
|
}
|
||||||
encounteredErrors = false;
|
encounteredErrors = false;
|
||||||
}
|
}
|
||||||
else if (at == ArchiveType.GZip && gz != ArchiveScanLevel.External)
|
else if (at == ArchiveType.GZip && gz != ArchiveScanLevel.External)
|
||||||
@@ -450,7 +454,13 @@ namespace SabreTools.Helper
|
|||||||
Directory.CreateDirectory(tempDir);
|
Directory.CreateDirectory(tempDir);
|
||||||
|
|
||||||
// Extract all files to the temp directory
|
// Extract all files to the temp directory
|
||||||
reader.WriteAllToDirectory(tempDir, ExtractOptions.ExtractFullPath | ExtractOptions.Overwrite);
|
bool succeeded = reader.MoveToNextEntry();
|
||||||
|
while (succeeded)
|
||||||
|
{
|
||||||
|
reader.WriteEntryToDirectory(tempDir, ExtractOptions.ExtractFullPath | ExtractOptions.Overwrite);
|
||||||
|
File.SetLastWriteTime(Path.Combine(tempDir, reader.Entry.Key), (DateTime)reader.Entry.LastModifiedTime);
|
||||||
|
succeeded = reader.MoveToNextEntry();
|
||||||
|
}
|
||||||
encounteredErrors = false;
|
encounteredErrors = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user