Throw a FileNotFoundException if source zip file isn't found.

This commit is contained in:
Paul Chote
2017-07-08 17:27:41 +01:00
committed by reaperrr
parent 6e145f902b
commit daf8f8d956

View File

@@ -99,12 +99,11 @@ namespace OpenRA.FileSystem
{
readonly MemoryStream pkgStream;
public ReadWriteZipFile(string filename, bool truncate = false)
public ReadWriteZipFile(string filename, bool create = false)
{
// SharpZipLib breaks when asked to update archives loaded from outside streams or files
// We can work around this by creating a clean in-memory-only file, cutting all outside references
pkgStream = File.Exists(filename) && !truncate ?
new MemoryStream(File.ReadAllBytes(filename)) : new MemoryStream();
pkgStream = create ? new MemoryStream() : new MemoryStream(File.ReadAllBytes(filename));
pkgStream.Position = 0;
pkg = ZipFileHelper.Create(pkgStream);