Skip to content

Commit 995ea60

Browse files
committed
IOUtil tweaks.
1 parent 9967650 commit 995ea60

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

xivModdingFramework/Helpers/IOUtil.cs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -797,16 +797,27 @@ public static byte[] GetImageSharpPixels(Image<Rgba32> img)
797797
}
798798
}
799799

800-
public static string GetUniqueSubfolder(string basePath, string prefix = "")
800+
public static string GetUniqueSubfolder(string basePath, string prefix = "", bool omitZero = false)
801801
{
802802
lock (_SubfolderLock)
803803
{
804804
var id = 0;
805805
var path = Path.GetFullPath(Path.Combine(basePath, prefix + id.ToString()));
806+
if (omitZero)
807+
{
808+
path = Path.GetFullPath(Path.Combine(basePath, prefix));
809+
}
806810
while (Directory.Exists(path))
807811
{
808812
id++;
809-
path = Path.GetFullPath(Path.Combine(basePath, prefix + id.ToString()));
813+
if (omitZero)
814+
{
815+
path = Path.GetFullPath(Path.Combine(basePath, prefix + " (" +id.ToString() +")"));
816+
}
817+
else
818+
{
819+
path = Path.GetFullPath(Path.Combine(basePath, prefix + id.ToString()));
820+
}
810821
}
811822
Directory.CreateDirectory(path);
812823
return path;

0 commit comments

Comments
 (0)