Check is file exists before add to archive

This commit is contained in:
Jaex 2018-03-19 02:18:02 +03:00
parent 76a318b295
commit 7b614e510b

View file

@ -107,10 +107,13 @@ public static void Compress(string archivePath, List<string> files, string worki
using (ZipArchive archive = ZipFile.Open(archivePath, ZipArchiveMode.Update)) using (ZipArchive archive = ZipFile.Open(archivePath, ZipArchiveMode.Update))
{ {
foreach (string file in files) foreach (string file in files)
{
if (File.Exists(file))
{ {
archive.CreateEntryFromFile(Path.Combine(workingDirectory, file), file, compression); archive.CreateEntryFromFile(Path.Combine(workingDirectory, file), file, compression);
} }
} }
} }
} }
}
} }