Skip to content

Commit

Permalink
Fix disabled mods patches still being applied ... pesky newlines
Browse files Browse the repository at this point in the history
  • Loading branch information
cheese3660 committed Jan 15, 2024
1 parent 3d1f21d commit 8125298
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/PatchManager.Core/CoreModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ public class CoreModule : BaseModule

private bool _wasCacheInvalidated;

private static bool ShouldLoad(string[] disabled, string modInfoLocation)
private static bool ShouldLoad(IEnumerable<string> disabled, string modInfoLocation)
{
if (!File.Exists(modInfoLocation))
return false;
try
{
var metadata = JsonConvert.DeserializeObject<ModInfo>(File.ReadAllText(modInfoLocation));
return metadata.ModID == null || !disabled.Contains(metadata.ModID);
return metadata.ModID == null || disabled.All(x => x != metadata.ModID);
}
catch
{
Expand Down Expand Up @@ -90,8 +90,8 @@ public override void PreLoad()
var gameDataModsExists = Directory.Exists(Path.Combine(Paths.GameRootPath, "GameData/Mods"));

// Go here instead so that the static constructor recognizes everything
var disabledPlugins = File.ReadAllText(Path.Combine(Paths.BepInExRootPath, "disabled_plugins.cfg"))
.Split(new[] { '\n' }, StringSplitOptions.RemoveEmptyEntries);
var disabledPlugins = File.ReadAllText(SpaceWarp.Preload.API.CommonPaths.DisabledPluginsFilepath)
.Split(new[] { '\n' }, StringSplitOptions.RemoveEmptyEntries).Select(x => x.Trim()).ToList();

var modFolders = Directory.GetDirectories(Paths.PluginPath, "*", SearchOption.AllDirectories)
.Where(dir => ShouldLoad(disabledPlugins, Path.Combine(dir, "swinfo.json")))
Expand Down
2 changes: 1 addition & 1 deletion src/PatchManager.Core/PatchManager.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<PackageReference Include="BepInEx.AssemblyPublicizer.MSBuild" Version="0.4.1" PrivateAssets="all" />
<PackageReference Include="KerbalSpaceProgram2.GameLibs" Version="0.2.0" PrivateAssets="all" Publicize="true" />
<PackageReference Include="Premonition.Core" Version="0.1.0" />
<PackageReference Include="SpaceWarp" Version="1.7.0" PrivateAssets="all" Publicize="true" />
<PackageReference Include="SpaceWarp" Version="1.8.1" PrivateAssets="all" Publicize="true" />
</ItemGroup>
<ItemGroup Label="Project references">
<ProjectReference Include="$(SolutionDir)/src/PatchManager.SassyPatching/PatchManager.SassyPatching.csproj" Private="false" />
Expand Down

0 comments on commit 8125298

Please sign in to comment.