Skip to content

Commit

Permalink
Handling for record templates split between base and portable SynthEB…
Browse files Browse the repository at this point in the history
…D install folders

Fix for crash when trying to install a config file archive that doesn't have a manifest
  • Loading branch information
Piranha91 committed Mar 22, 2022
1 parent 8c8ac3a commit c4be325
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
8 changes: 4 additions & 4 deletions SynthEBD.Tests/SetViaFormKeyReplacementTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class SetViaFormKeyReplacementTests
[Fact]
public void ArrayDynamic()
{
var mod = new SkyrimMod(ModKey.Null, SkyrimGameType.SkyrimSE);
var mod = new SkyrimMod(ModKey.Null, SkyrimRelease.SkyrimSE);
var arm = mod.Armors.AddNew();
arm.Armature.Add(mod.ArmorAddons.AddNew());
dynamic list = arm.Armature;
Expand All @@ -25,7 +25,7 @@ public void ArrayDynamic()
[Fact]
public void ArrayStraight()
{
var mod = new SkyrimMod(ModKey.Null, SkyrimGameType.SkyrimSE);
var mod = new SkyrimMod(ModKey.Null, SkyrimRelease.SkyrimSE);
var arm = mod.Armors.AddNew();
arm.Armature.Add(mod.ArmorAddons.AddNew());
var list = arm.Armature;
Expand All @@ -37,7 +37,7 @@ public void ArrayStraight()
[Fact]
public void SingleDynamic()
{
var mod = new SkyrimMod(ModKey.Null, SkyrimGameType.SkyrimSE);
var mod = new SkyrimMod(ModKey.Null, SkyrimRelease.SkyrimSE);
var arm = mod.Armors.AddNew();
arm.Race.SetTo(mod.Races.AddNew());
dynamic dyn = arm;
Expand All @@ -49,7 +49,7 @@ public void SingleDynamic()
[Fact]
public void SingleStraight()
{
var mod = new SkyrimMod(ModKey.Null, SkyrimGameType.SkyrimSE);
var mod = new SkyrimMod(ModKey.Null, SkyrimRelease.SkyrimSE);
var arm = mod.Armors.AddNew();
arm.Race.SetTo(mod.Races.AddNew());
var race = new Race(mod);
Expand Down
1 change: 1 addition & 0 deletions SynthEBD/Installer/ConfigInstaller.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ public static List<string> InstallConfigFile()
if (!File.Exists(manifestPath))
{
System.Windows.MessageBox.Show("Could not find Manifest.json in " + tempFolderPath + ". Installation aborted.");
return installedConfigs;
}

Manifest manifest = JSONhandler<Manifest>.LoadJSONFile(manifestPath, out bool parsed, out string exceptionStr);
Expand Down
6 changes: 6 additions & 0 deletions SynthEBD/Settings/SettingsIO/SettingsIO_AssetPack.cs
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,12 @@ public static List<SkyrimMod> LoadRecordTemplates(out bool loadSuccess)
if (Directory.Exists(PatcherSettings.Paths.RecordTemplatesDirPath))
{
filePaths = Directory.GetFiles(PatcherSettings.Paths.RecordTemplatesDirPath, "*.esp");

// load any available record templates in the fallback folder since they may not have been copied over and missing them will screw up the config files
var fileNames = filePaths.Select(x => Path.GetFileName(x));
var fallBackFilePaths = Directory.GetFiles(PatcherSettings.Paths.GetFallBackPath(PatcherSettings.Paths.RecordTemplatesDirPath), "*.esp");
var additionalFilePaths = fallBackFilePaths.Where(x => !fileNames.Contains(Path.GetFileName(x)));
filePaths = filePaths.Concat(additionalFilePaths).ToArray();
}
else
{
Expand Down

0 comments on commit c4be325

Please sign in to comment.