Skip to content

Commit 874b87e

Browse files
committed
make sure pack paths exist
1 parent dc85e6d commit 874b87e

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

Patchwork.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<TargetFramework>netstandard2.1</TargetFramework>
55
<AssemblyName>Patchwork</AssemblyName>
66
<Product>Patchwork</Product>
7-
<Version>2.1.0</Version>
7+
<Version>2.1.1</Version>
88
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
99
<LangVersion>latest</LangVersion>
1010
<RestoreAdditionalProjectSources>

handlers/SpriteLoader.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,8 @@ private static Texture2D FindSprite(string collectionName, string materialName,
8686

8787
foreach (var packPath in Plugin.PluginPackPaths)
8888
{
89+
if (!Directory.Exists(Path.Combine(packPath, "Sprites")))
90+
continue;
8991
var packFiles = Directory.GetFiles(Path.Combine(packPath, "Sprites"), $"{spriteName}.png", SearchOption.AllDirectories)
9092
.Where(f => Path.GetDirectoryName(f).EndsWith(Path.Combine(collectionName, materialName)));
9193
if (packFiles.Any())
@@ -110,6 +112,8 @@ private static RenderTexture FindSpritesheet(tk2dSpriteCollectionData collection
110112

111113
foreach (var packPath in Plugin.PluginPackPaths)
112114
{
115+
if(!Directory.Exists(Path.Combine(packPath, "Spritesheets")))
116+
continue;
113117
var packFiles = Directory.GetFiles(Path.Combine(packPath, "Spritesheets"), $"{materialName}.png", SearchOption.AllDirectories)
114118
.Where(f => Path.GetDirectoryName(f).EndsWith(collection.name));
115119
if (packFiles.Any())

handlers/T2DHandler.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,8 @@ private static Texture2D FindT2DSprite(string spriteName)
169169

170170
foreach (var packPath in Plugin.PluginPackPaths)
171171
{
172+
if (!Directory.Exists(Path.Combine(packPath, "Sprites")))
173+
continue;
172174
var packFiles = Directory.GetFiles(Path.Combine(packPath, "Sprites"), spriteName + ".png", SearchOption.AllDirectories)
173175
.Where(f => Path.GetDirectoryName(f).EndsWith("T2D"));
174176
if (packFiles.Any())
@@ -187,6 +189,8 @@ private static Texture2D FindT2DSprite(string texName, string spriteName)
187189

188190
foreach (var packPath in Plugin.PluginPackPaths)
189191
{
192+
if (!Directory.Exists(Path.Combine(packPath, "Sprites")))
193+
continue;
190194
var packFiles = Directory.GetFiles(Path.Combine(packPath, "Sprites"), spriteName + ".png", SearchOption.AllDirectories)
191195
.Where(f => Path.GetDirectoryName(f).EndsWith(Path.Combine("T2D", texName)));
192196
if (packFiles.Any())

0 commit comments

Comments
 (0)