Don't save assets more than once
This commit is contained in:
parent
195bd55c83
commit
644813d62c
3 changed files with 13 additions and 3 deletions
|
|
@ -143,6 +143,7 @@ namespace MatterHackers.MatterControl.Library
|
|||
{
|
||||
using (var zip = new ZipArchive(file, ZipArchiveMode.Create))
|
||||
{
|
||||
var savedItems = new HashSet<string>();
|
||||
foreach (var persistableItem in persistableItems)
|
||||
{
|
||||
string sourcePath = null;
|
||||
|
|
@ -156,10 +157,19 @@ namespace MatterHackers.MatterControl.Library
|
|||
sourcePath = assetObject3D.AssetPath;
|
||||
}
|
||||
|
||||
var destFilename = Path.GetFileName(sourcePath);
|
||||
if (File.Exists(sourcePath))
|
||||
{
|
||||
var assetName = Path.Combine("Assets", Path.GetFileName(sourcePath));
|
||||
zip.CreateEntryFromFile(sourcePath, assetName);
|
||||
if (!savedItems.Contains(destFilename))
|
||||
{
|
||||
savedItems.Add(destFilename);
|
||||
var assetName = Path.Combine("Assets", destFilename);
|
||||
zip.CreateEntryFromFile(sourcePath, assetName);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int a = 0;
|
||||
}
|
||||
|
||||
savedCount++;
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -1 +1 @@
|
|||
Subproject commit ca796051b031627d420d38ef7e44aa5346771478
|
||||
Subproject commit f8a6ce095e4a653cb714b1816e00949722497b3e
|
||||
Loading…
Add table
Add a link
Reference in a new issue