mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
[ArchiveTools] Make absolutely sure that TGZ files don't overwrite
This commit is contained in:
@@ -1043,9 +1043,15 @@ namespace SabreTools.Helper
|
||||
// Now get the Rom info for the file so we have hashes and size
|
||||
Rom rom = FileTools.GetFileInfo(input, logger);
|
||||
|
||||
// If it doesn't exist, create the output file and then write
|
||||
// Get the output file name
|
||||
string outfile = Path.Combine(outDir, rom.SHA1 + ".gz");
|
||||
|
||||
// If the output file exists, don't try to write again
|
||||
if (File.Exists(outfile))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// Compress the input stream
|
||||
FileStream inputStream = File.OpenRead(input);
|
||||
GZipStream outputStream = new GZipStream(File.Open(outfile, FileMode.Create, FileAccess.Write), CompressionMode.Compress);
|
||||
|
||||
Reference in New Issue
Block a user