Add safety against zip creation potentially failing (probably can't but still)

This commit is contained in:
Dean Herbert 2022-01-27 14:55:52 +09:00
parent 465e7d29fe
commit fb081384e1

View File

@ -166,11 +166,15 @@ namespace osu.Game.Database
backupStorage.Delete(attachment_filename);
using (var zip = ZipArchive.Create())
try
{
zip.AddAllFromDirectory(backupStorage.GetFullPath(string.Empty));
zip.SaveTo(Path.Combine(backupStorage.GetFullPath(string.Empty), attachment_filename), new ZipWriterOptions(CompressionType.Deflate));
using (var zip = ZipArchive.Create())
{
zip.AddAllFromDirectory(backupStorage.GetFullPath(string.Empty));
zip.SaveTo(Path.Combine(backupStorage.GetFullPath(string.Empty), attachment_filename), new ZipWriterOptions(CompressionType.Deflate));
}
}
catch { }
backupStorage.PresentFileExternally(attachment_filename);