Skip to content

Commit 903d33b

Browse files
committed
Update v3.0.6.5
2 parents 032718c + 9425e9d commit 903d33b

File tree

2 files changed

+30
-8
lines changed

2 files changed

+30
-8
lines changed

xivModdingFramework/Helpers/IOUtil.cs

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -799,17 +799,21 @@ public static byte[] GetImageSharpPixels(Image<Rgba32> img)
799799

800800
public static string GetUniqueSubfolder(string basePath, string prefix = "")
801801
{
802-
var id = 0;
803-
var path = Path.GetFullPath(Path.Combine(basePath, prefix + id.ToString()));
804-
while (Directory.Exists(path))
802+
lock (_SubfolderLock)
805803
{
806-
id++;
807-
path = Path.GetFullPath(Path.Combine(basePath, prefix + id.ToString()));
804+
var id = 0;
805+
var path = Path.GetFullPath(Path.Combine(basePath, prefix + id.ToString()));
806+
while (Directory.Exists(path))
807+
{
808+
id++;
809+
path = Path.GetFullPath(Path.Combine(basePath, prefix + id.ToString()));
810+
}
811+
Directory.CreateDirectory(path);
812+
return path;
808813
}
809-
Directory.CreateDirectory(path);
810-
811-
return path;
812814
}
815+
816+
public static object _SubfolderLock = new object();
813817
public static string GetFrameworkTempSubfolder(string prefix = "")
814818
{
815819
var basePath = GetFrameworkTempFolder();

xivModdingFramework/Mods/FileTypes/PMP.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,24 @@ await IOUtil.UnzipFiles(path, tempFolder, (file) =>
8282
});
8383
path = tempFolder;
8484
}
85+
86+
var metaPath = Path.GetFullPath(Path.Combine(path, "meta.json"));
87+
if (!File.Exists(metaPath))
88+
{
89+
if (Directory.Exists(path))
90+
{
91+
var subs = Directory.EnumerateDirectories(path).ToList();
92+
if(subs.Count == 1)
93+
{
94+
metaPath = Path.GetFullPath(Path.Combine(path, subs[0], "meta.json"));
95+
if (File.Exists(metaPath))
96+
{
97+
path = Path.GetFullPath(Path.Combine(path, subs[0]));
98+
}
99+
}
100+
}
101+
}
102+
85103
return path;
86104
}
87105

0 commit comments

Comments
 (0)