File tree Expand file tree Collapse file tree 3 files changed +26
-2
lines changed Expand file tree Collapse file tree 3 files changed +26
-2
lines changed Original file line number Diff line number Diff line change 3
3
using System . IO ;
4
4
using System . Threading . Tasks ;
5
5
using xivModdingFramework . General . Enums ;
6
+ using xivModdingFramework . Helpers ;
6
7
7
8
namespace xivModdingFramework . Cache
8
9
{
@@ -80,6 +81,10 @@ public static async Task InitCacheFromConfig(bool runWorker = false)
80
81
throw new ArgumentException ( "Console Config file does not have a valid FFXIV File path configured." ) ;
81
82
}
82
83
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 ;
83
88
}
84
89
}
85
90
}
Original file line number Diff line number Diff line change @@ -797,16 +797,27 @@ public static byte[] GetImageSharpPixels(Image<Rgba32> img)
797
797
}
798
798
}
799
799
800
- public static string GetUniqueSubfolder ( string basePath , string prefix = "" )
800
+ public static string GetUniqueSubfolder ( string basePath , string prefix = "" , bool omitZero = false )
801
801
{
802
802
lock ( _SubfolderLock )
803
803
{
804
804
var id = 0 ;
805
805
var path = Path . GetFullPath ( Path . Combine ( basePath , prefix + id . ToString ( ) ) ) ;
806
+ if ( omitZero )
807
+ {
808
+ path = Path . GetFullPath ( Path . Combine ( basePath , prefix ) ) ;
809
+ }
806
810
while ( Directory . Exists ( path ) )
807
811
{
808
812
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
+ }
810
821
}
811
822
Directory . CreateDirectory ( path ) ;
812
823
return path ;
Original file line number Diff line number Diff line change @@ -79,6 +79,14 @@ static Modding()
79
79
80
80
public static bool ValidateModlist ( string ffxivDirectory = null )
81
81
{
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
+
82
90
var dir = string . IsNullOrEmpty ( ffxivDirectory ) ? XivCache . GameInfo . GameDirectory . FullName : ffxivDirectory ;
83
91
dir = new DirectoryInfo ( dir ) . Parent . Parent . FullName ;
84
92
You can’t perform that action at this time.
0 commit comments