@@ -47,15 +47,15 @@ public ModManager(Configuration config, CommunicatorService communicator, ModDat
47
47
DataEditor = dataEditor ;
48
48
OptionEditor = optionEditor ;
49
49
Creator = creator ;
50
- SetBaseDirectory ( config . ModDirectory , true ) ;
50
+ SetBaseDirectory ( config . ModDirectory , true , out _ ) ;
51
51
_communicator . ModPathChanged . Subscribe ( OnModPathChange , ModPathChanged . Priority . ModManager ) ;
52
52
DiscoverMods ( ) ;
53
53
}
54
54
55
55
/// <summary> Change the mod base directory and discover available mods. </summary>
56
- public void DiscoverMods ( string newDir )
56
+ public void DiscoverMods ( string newDir , out string resultNewDir )
57
57
{
58
- SetBaseDirectory ( newDir , false ) ;
58
+ SetBaseDirectory ( newDir , false , out resultNewDir ) ;
59
59
DiscoverMods ( ) ;
60
60
}
61
61
@@ -264,8 +264,9 @@ public void Dispose()
264
264
/// If its not the first time, check if it is the same directory as before.
265
265
/// Also checks if the directory is available and tries to create it if it is not.
266
266
/// </summary>
267
- private void SetBaseDirectory ( string newPath , bool firstTime )
267
+ private void SetBaseDirectory ( string newPath , bool firstTime , out string resultNewDir )
268
268
{
269
+ resultNewDir = newPath ;
269
270
if ( ! firstTime && string . Equals ( newPath , _config . ModDirectory , StringComparison . Ordinal ) )
270
271
return ;
271
272
@@ -278,7 +279,7 @@ private void SetBaseDirectory(string newPath, bool firstTime)
278
279
}
279
280
else
280
281
{
281
- var newDir = new DirectoryInfo ( newPath ) ;
282
+ var newDir = new DirectoryInfo ( Path . TrimEndingDirectorySeparator ( newPath ) ) ;
282
283
if ( ! newDir . Exists )
283
284
try
284
285
{
@@ -290,8 +291,9 @@ private void SetBaseDirectory(string newPath, bool firstTime)
290
291
Penumbra . Log . Error ( $ "Could not create specified mod directory { newDir . FullName } :\n { e } ") ;
291
292
}
292
293
293
- BasePath = newDir ;
294
- Valid = Directory . Exists ( newDir . FullName ) ;
294
+ BasePath = newDir ;
295
+ Valid = Directory . Exists ( newDir . FullName ) ;
296
+ resultNewDir = BasePath . FullName ;
295
297
if ( ! firstTime && _config . ModDirectory != BasePath . FullName )
296
298
TriggerModDirectoryChange ( BasePath . FullName , Valid ) ;
297
299
}
0 commit comments