mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Merge pull request #863 from wabbajack-tools/issue-861
issue-861 - Fix always enabled mods being out of order
This commit is contained in:
commit
c5196559cc
@ -46,7 +46,6 @@ namespace Wabbajack.Common
|
|||||||
public static string WABBAJACK_INCLUDE = "WABBAJACK_INCLUDE";
|
public static string WABBAJACK_INCLUDE = "WABBAJACK_INCLUDE";
|
||||||
public static string WABBAJACK_ALWAYS_ENABLE = "WABBAJACK_ALWAYS_ENABLE";
|
public static string WABBAJACK_ALWAYS_ENABLE = "WABBAJACK_ALWAYS_ENABLE";
|
||||||
public static string WABBAJACK_NOMATCH_INCLUDE = "WABBAJACK_NOMATCH_INCLUDE";
|
public static string WABBAJACK_NOMATCH_INCLUDE = "WABBAJACK_NOMATCH_INCLUDE";
|
||||||
public static string WABBAJACK_VORTEX_MANUAL = "WABBAJACK_VORTEX_MANUAL";
|
|
||||||
|
|
||||||
public static string GAME_PATH_MAGIC_BACK = "{--||GAME_PATH_MAGIC_BACK||--}";
|
public static string GAME_PATH_MAGIC_BACK = "{--||GAME_PATH_MAGIC_BACK||--}";
|
||||||
public static string GAME_PATH_MAGIC_DOUBLE_BACK = "{--||GAME_PATH_MAGIC_DOUBLE_BACK||--}";
|
public static string GAME_PATH_MAGIC_DOUBLE_BACK = "{--||GAME_PATH_MAGIC_DOUBLE_BACK||--}";
|
||||||
|
@ -43,6 +43,7 @@ namespace Wabbajack.Lib.CompilationSteps
|
|||||||
{
|
{
|
||||||
var alwaysEnabled = _mo2Compiler.ModInis.Where(f => IgnoreDisabledMods.IsAlwaysEnabled(f.Value))
|
var alwaysEnabled = _mo2Compiler.ModInis.Where(f => IgnoreDisabledMods.IsAlwaysEnabled(f.Value))
|
||||||
.Select(f => f.Key)
|
.Select(f => f.Key)
|
||||||
|
.Select(f => f.FileName.ToString())
|
||||||
.Distinct();
|
.Distinct();
|
||||||
var lines = (await absolutePath.ReadAllLinesAsync()).Where(l =>
|
var lines = (await absolutePath.ReadAllLinesAsync()).Where(l =>
|
||||||
{
|
{
|
||||||
|
@ -473,5 +473,51 @@ namespace Wabbajack.Test
|
|||||||
utils.VerifyInstalledFile(mod, @"Data\scripts\test.pex");
|
utils.VerifyInstalledFile(mod, @"Data\scripts\test.pex");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Issue #861 : https://github.com/wabbajack-tools/wabbajack/issues/861
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
[Fact]
|
||||||
|
public async Task AlwaysEnabledModsRetainTheirOrder()
|
||||||
|
{
|
||||||
|
|
||||||
|
var profile = utils.AddProfile();
|
||||||
|
var enabledMod = utils.AddMod();
|
||||||
|
var enabledTestPex = utils.AddModFile(enabledMod, @"Data\scripts\enabledTestPex.pex", 10);
|
||||||
|
|
||||||
|
var disabledMod = utils.AddMod();
|
||||||
|
var disabledTestPex = utils.AddModFile(disabledMod, @"Data\scripts\disabledTestPex.pex", 10);
|
||||||
|
|
||||||
|
await disabledMod.RelativeTo(utils.ModsFolder).Combine("meta.ini").WriteAllLinesAsync(
|
||||||
|
"[General]",
|
||||||
|
$"notes={Consts.WABBAJACK_ALWAYS_ENABLE}");
|
||||||
|
|
||||||
|
await utils.Configure(new []
|
||||||
|
{
|
||||||
|
(disabledMod, false),
|
||||||
|
(enabledMod, true)
|
||||||
|
});
|
||||||
|
|
||||||
|
utils.AddManualDownload(
|
||||||
|
new Dictionary<string, byte[]>
|
||||||
|
{
|
||||||
|
{"/file1.pex", await enabledTestPex.ReadAllBytesAsync()},
|
||||||
|
{"/file2.pex", await disabledTestPex.ReadAllBytesAsync()},
|
||||||
|
});
|
||||||
|
|
||||||
|
await CompileAndInstall(profile);
|
||||||
|
|
||||||
|
utils.VerifyInstalledFile(enabledMod, @"Data\scripts\enabledTestPex.pex");
|
||||||
|
utils.VerifyInstalledFile(disabledMod, @"Data\scripts\disabledTestPex.pex");
|
||||||
|
|
||||||
|
var modlistTxt = await utils.InstallFolder.Combine("profiles", profile, "modlist.txt").ReadAllLinesAsync();
|
||||||
|
Assert.Equal(new string[]
|
||||||
|
{
|
||||||
|
$"-{disabledMod}",
|
||||||
|
$"+{enabledMod}"
|
||||||
|
}, modlistTxt.ToArray());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,7 @@ namespace Wabbajack.Test
|
|||||||
|
|
||||||
public List<string> Mods = new List<string>();
|
public List<string> Mods = new List<string>();
|
||||||
|
|
||||||
public async Task Configure()
|
public async Task Configure(IEnumerable<(string ModName, bool IsEnabled)> enabledMods = null)
|
||||||
{
|
{
|
||||||
await MO2Folder.Combine("ModOrganizer.ini").WriteAllLinesAsync(
|
await MO2Folder.Combine("ModOrganizer.ini").WriteAllLinesAsync(
|
||||||
"[General]",
|
"[General]",
|
||||||
@ -53,12 +53,23 @@ namespace Wabbajack.Test
|
|||||||
DownloadsFolder.CreateDirectory();
|
DownloadsFolder.CreateDirectory();
|
||||||
GameFolder.Combine("Data").CreateDirectory();
|
GameFolder.Combine("Data").CreateDirectory();
|
||||||
|
|
||||||
|
if (enabledMods == null)
|
||||||
|
{
|
||||||
Profiles.Do(profile =>
|
Profiles.Do(profile =>
|
||||||
{
|
{
|
||||||
MO2Folder.Combine("profiles", profile, "modlist.txt").WriteAllLines(
|
MO2Folder.Combine("profiles", profile, "modlist.txt").WriteAllLines(
|
||||||
Mods.Select(s => $"+{s}").ToArray());
|
Mods.Select(s => $"+{s}").ToArray());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Profiles.Do(profile =>
|
||||||
|
{
|
||||||
|
MO2Folder.Combine("profiles", profile, "modlist.txt").WriteAllLines(
|
||||||
|
enabledMods.Select(s => $"{(s.IsEnabled ? "+" : "-")}{s.ModName}").ToArray());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public string AddProfile(string name = null)
|
public string AddProfile(string name = null)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user