Skip to content

Commit f671682

Browse files
committed
Update v3.0.8.1
2 parents 12dec77 + 995ea60 commit f671682

File tree

3 files changed

+26
-2
lines changed

3 files changed

+26
-2
lines changed

xivModdingFramework/Cache/ConsoleConfig.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using System.IO;
44
using System.Threading.Tasks;
55
using xivModdingFramework.General.Enums;
6+
using xivModdingFramework.Helpers;
67

78
namespace xivModdingFramework.Cache
89
{
@@ -80,6 +81,10 @@ public static async Task InitCacheFromConfig(bool runWorker = false)
8081
throw new ArgumentException("Console Config file does not have a valid FFXIV File path configured.");
8182
}
8283
await XivCache.SetGameInfo(new DirectoryInfo(c.XivPath), c.XivLanguage, runWorker);
84+
85+
// Set a unique temp path.
86+
var tempDir = IOUtil.GetUniqueSubfolder(Path.GetTempPath(), "xivct");
87+
XivCache.FrameworkSettings.TempDirectory = tempDir;
8388
}
8489
}
8590
}

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;

xivModdingFramework/Mods/Modding.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,14 @@ static Modding()
7979

8080
public static bool ValidateModlist(string ffxivDirectory = null)
8181
{
82+
if(ffxivDirectory == null &&
83+
(XivCache.GameInfo == null
84+
|| XivCache.GameInfo.GameDirectory == null
85+
|| string.IsNullOrWhiteSpace(XivCache.GameInfo.GameDirectory.FullName)))
86+
{
87+
throw new InvalidDataException("Cannot validate modlist for NULL directory.");
88+
}
89+
8290
var dir = string.IsNullOrEmpty(ffxivDirectory) ? XivCache.GameInfo.GameDirectory.FullName : ffxivDirectory;
8391
dir = new DirectoryInfo(dir).Parent.Parent.FullName;
8492

0 commit comments

Comments
 (0)