mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Merge pull request #1080 from wabbajack-tools/move-ini-include
Move where we include ini additions
This commit is contained in:
commit
4da8fbb9f7
@ -100,7 +100,7 @@ namespace Wabbajack.Lib.Downloaders
|
||||
|
||||
public string GetMetaIniString()
|
||||
{
|
||||
return $"{string.Join("\n", GetMetaIni())}\ninstalled=true";
|
||||
return string.Join("\n", GetMetaIni());
|
||||
}
|
||||
|
||||
public async Task<(Archive? Archive, TempFile NewFile)> ServerFindUpgrade(Archive a)
|
||||
|
@ -252,14 +252,34 @@ namespace Wabbajack.Lib
|
||||
.OfType<ArchiveMeta>()
|
||||
.PMap(Queue, async directive =>
|
||||
{
|
||||
Status($"Writing included .meta file {directive.To}");
|
||||
var outPath = DownloadFolder.Combine(directive.To);
|
||||
if (outPath.IsFile) await outPath.DeleteAsync();
|
||||
var bytes = await LoadBytesFromPath(directive.SourceDataID);
|
||||
await outPath.WriteAllBytesAsync(bytes);
|
||||
Status($"Writing .meta file {directive.To}");
|
||||
foreach (var archive in ModList.Archives)
|
||||
{
|
||||
if (HashedArchives.TryGetValue(archive.Hash, out var paths))
|
||||
{
|
||||
var metaPath = paths.WithExtension(Consts.MetaFileExtension);
|
||||
if (!metaPath.Exists)
|
||||
{
|
||||
var meta = AddInstalled(archive.State.GetMetaIni()).ToArray();
|
||||
await metaPath.WriteAllLinesAsync(meta);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private IEnumerable<string> AddInstalled(string[] getMetaIni)
|
||||
{
|
||||
foreach (var f in getMetaIni)
|
||||
{
|
||||
yield return f;
|
||||
if (f == "[General]")
|
||||
{
|
||||
yield return "installed=true";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private async ValueTask ValidateGameESMs()
|
||||
{
|
||||
foreach (var esm in ModList.Directives.OfType<CleanedESM>().ToList())
|
||||
|
Loading…
Reference in New Issue
Block a user