Skip to content

Commit

Permalink
Merge pull request #236 from BUTR/dev
Browse files Browse the repository at this point in the history
v2.3.4
  • Loading branch information
Aragas authored Nov 1, 2022
2 parents c20048e + 8919624 commit 32c1329
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 17 deletions.
2 changes: 1 addition & 1 deletion build/common.props
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<!--Development Variables-->
<PropertyGroup>
<!--Module Version-->
<Version>2.3.3</Version>
<Version>2.3.4</Version>
<!--Harmony Version-->
<HarmonyVersion>2.2.2</HarmonyVersion>
<HarmonyExtensionsVersion>3.1.0.67</HarmonyExtensionsVersion>
Expand Down
4 changes: 4 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
---------------------------------------------------------------------------------------------------
Version: 2.3.4
Game Versions: v1.0.0
* Another potential CTD fix
---------------------------------------------------------------------------------------------------
Version: 2.3.3
Game Versions: v1.0.0
* Added "Catch Native->Managed Code Exceptions"
Expand Down
36 changes: 20 additions & 16 deletions src/Bannerlord.ButterLib/ButterLibSubModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -240,28 +240,32 @@ private void InitializeServices()

private static void PerformMigration001()
{
var oldConfigPath = Path.GetFullPath("Configs");
var oldPath = Path.Combine(oldConfigPath, "ModLogs");
var newPath = Path.Combine(PlatformFileHelperPCExtended.GetDirectoryFullPath(EngineFilePaths.ConfigsPath), "ModLogs");
if (Directory.Exists(oldPath) && Directory.Exists(newPath))
try
{
foreach (var filePath in Directory.GetFiles(oldPath))
var oldConfigPath = Path.GetFullPath("Configs");
var oldPath = Path.Combine(oldConfigPath, "ModLogs");
var newPath = Path.Combine(PlatformFileHelperPCExtended.GetDirectoryFullPath(EngineFilePaths.ConfigsPath), "ModLogs");
if (Directory.Exists(oldPath) && Directory.Exists(newPath))
{
var fileName = Path.GetFileName(filePath);
var newFilePath = Path.Combine(newPath, fileName);
try
foreach (var filePath in Directory.GetFiles(oldPath))
{
File.Copy(filePath, newFilePath, true);
File.Delete(filePath);
var fileName = Path.GetFileName(filePath);
var newFilePath = Path.Combine(newPath, fileName);
try
{
File.Copy(filePath, newFilePath, true);
File.Delete(filePath);
}
catch (Exception) { }
}
catch { }
}

if (Directory.GetFiles(oldPath) is { Length: 0 } && Directory.GetDirectories(oldPath) is { Length: 0})
Directory.Delete(oldPath, true);
if (Directory.GetFiles(oldConfigPath) is { Length: 0 } && Directory.GetDirectories(oldConfigPath) is { Length: 0})
Directory.Delete(oldConfigPath, true);
if (Directory.GetFiles(oldPath) is { Length: 0 } && Directory.GetDirectories(oldPath) is { Length: 0})
Directory.Delete(oldPath, true);
if (Directory.GetFiles(oldConfigPath) is { Length: 0 } && Directory.GetDirectories(oldConfigPath) is { Length: 0})
Directory.Delete(oldConfigPath, true);
}
}
catch (Exception) { }
}
}
}

0 comments on commit 32c1329

Please sign in to comment.