Skip to content

Commit

Permalink
Clearing output Directory items before generating new stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
ptedeschi committed Feb 18, 2022
1 parent ceb765c commit e639575
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/NFT.net/NFT.net.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<UseWindowsForms>true</UseWindowsForms>
<RootNamespace>Tedeschi.NFT</RootNamespace>
<AssemblyName>NFT.net</AssemblyName>
<Version>1.3.0</Version>
<Version>1.4.0</Version>
<Authors>Tedeschi</Authors>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
<SelfContained>true</SelfContained>
<PublishSingleFile>True</PublishSingleFile>
<PublishReadyToRun>False</PublishReadyToRun>
<PublishTrimmed>False</PublishTrimmed>
<PublishTrimmed>True</PublishTrimmed>
</PropertyGroup>
</Project>
23 changes: 21 additions & 2 deletions src/NFT.net/Services/Collection/CollectionService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,30 @@ public void Create(string layersFolder, string outputFolder, int metadataType, s
var collectionNumber = collectionInitialNumber;
var metadataList = new List<Metadata>();

// Handle Images folder
var imagesFoder = $"{outputFolder}{Path.DirectorySeparatorChar}{Constants.ImagesFolderName}";

if (!Directory.Exists(imagesFoder))
if (Directory.Exists(imagesFoder))
{
Directory.CreateDirectory(imagesFoder);
Directory.Delete(imagesFoder, true);
}

Directory.CreateDirectory(imagesFoder);

// Handle Metadata folder
var metadataLocation = $"{outputFolder}{Path.DirectorySeparatorChar}{Constants.MetadataDefault.FolderName}";

if (Directory.Exists(metadataLocation))
{
Directory.Delete(metadataLocation, true);
}

// Handle Rarity folder
var rarityLocation = $"{outputFolder}{Path.DirectorySeparatorChar}{Constants.RarityDefault.FolderName}";

if (Directory.Exists(rarityLocation))
{
Directory.Delete(rarityLocation, true);
}

foreach (var item in imageDescriptors)
Expand Down

0 comments on commit e639575

Please sign in to comment.