mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Fixup missing .meta file when WJ uses a separate download folder
This commit is contained in:
parent
f39fe51328
commit
b8471a41b3
@ -16,6 +16,7 @@ namespace Wabbajack.Lib
|
|||||||
typeof(NoMatch), typeof(InlineFile), typeof(PropertyType), typeof(CleanedESM),
|
typeof(NoMatch), typeof(InlineFile), typeof(PropertyType), typeof(CleanedESM),
|
||||||
typeof(RemappedInlineFile), typeof(FromArchive), typeof(CreateBSA), typeof(PatchedFromArchive),
|
typeof(RemappedInlineFile), typeof(FromArchive), typeof(CreateBSA), typeof(PatchedFromArchive),
|
||||||
typeof(SourcePatch), typeof(MergedPatch), typeof(Archive), typeof(IndexedArchive), typeof(IndexedEntry),
|
typeof(SourcePatch), typeof(MergedPatch), typeof(Archive), typeof(IndexedArchive), typeof(IndexedEntry),
|
||||||
|
typeof(ArchiveMeta),
|
||||||
typeof(IndexedArchiveEntry), typeof(BSAIndexedEntry), typeof(VirtualFile),
|
typeof(IndexedArchiveEntry), typeof(BSAIndexedEntry), typeof(VirtualFile),
|
||||||
typeof(ArchiveStateObject), typeof(FileStateObject), typeof(IDownloader),
|
typeof(ArchiveStateObject), typeof(FileStateObject), typeof(IDownloader),
|
||||||
typeof(IUrlDownloader), typeof(AbstractDownloadState), typeof(ManualDownloader.State),
|
typeof(IUrlDownloader), typeof(AbstractDownloadState), typeof(ManualDownloader.State),
|
||||||
|
@ -273,6 +273,7 @@ namespace Wabbajack.Lib
|
|||||||
zEditIntegration.VerifyMerges(this);
|
zEditIntegration.VerifyMerges(this);
|
||||||
|
|
||||||
GatherArchives();
|
GatherArchives();
|
||||||
|
IncludeArchiveMetadata();
|
||||||
BuildPatches();
|
BuildPatches();
|
||||||
|
|
||||||
ModList = new ModList
|
ModList = new ModList
|
||||||
@ -302,6 +303,22 @@ namespace Wabbajack.Lib
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void IncludeArchiveMetadata()
|
||||||
|
{
|
||||||
|
Utils.Log($"Including {SelectedArchives.Count} .meta files for downloads");
|
||||||
|
SelectedArchives.Do(a =>
|
||||||
|
{
|
||||||
|
var source = Path.Combine(MO2DownloadsFolder, a.Name + ".meta");
|
||||||
|
InstallDirectives.Add(new ArchiveMeta()
|
||||||
|
{
|
||||||
|
SourceDataID = IncludeFile(File.ReadAllText(source)),
|
||||||
|
Size = File.GetSize(source),
|
||||||
|
Hash = source.FileHash(),
|
||||||
|
To = Path.GetFileName(source)
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
private void ExportModlist()
|
private void ExportModlist()
|
||||||
{
|
{
|
||||||
Utils.Log($"Exporting Modlist to : {ModListOutputFile}");
|
Utils.Log($"Exporting Modlist to : {ModListOutputFile}");
|
||||||
@ -540,7 +557,6 @@ namespace Wabbajack.Lib
|
|||||||
{
|
{
|
||||||
new IncludePropertyFiles(this),
|
new IncludePropertyFiles(this),
|
||||||
new IgnoreStartsWith(this,"logs\\"),
|
new IgnoreStartsWith(this,"logs\\"),
|
||||||
new IncludeRegex(this, "^downloads\\\\.*\\.meta"),
|
|
||||||
new IgnoreStartsWith(this, "downloads\\"),
|
new IgnoreStartsWith(this, "downloads\\"),
|
||||||
new IgnoreStartsWith(this,"webcache\\"),
|
new IgnoreStartsWith(this,"webcache\\"),
|
||||||
new IgnoreStartsWith(this, "overwrite\\"),
|
new IgnoreStartsWith(this, "overwrite\\"),
|
||||||
|
@ -118,6 +118,11 @@ namespace Wabbajack.Lib
|
|||||||
public string SourceDataID;
|
public string SourceDataID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class ArchiveMeta : Directive
|
||||||
|
{
|
||||||
|
public string SourceDataID;
|
||||||
|
}
|
||||||
|
|
||||||
public enum PropertyType { Banner, Readme }
|
public enum PropertyType { Banner, Readme }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -155,6 +155,7 @@ namespace Wabbajack.Lib
|
|||||||
BuildFolderStructure();
|
BuildFolderStructure();
|
||||||
InstallArchives();
|
InstallArchives();
|
||||||
InstallIncludedFiles();
|
InstallIncludedFiles();
|
||||||
|
InctallIncludedDownloadMetas();
|
||||||
BuildBSAs();
|
BuildBSAs();
|
||||||
|
|
||||||
zEditIntegration.GenerateMerges(this);
|
zEditIntegration.GenerateMerges(this);
|
||||||
@ -165,6 +166,19 @@ namespace Wabbajack.Lib
|
|||||||
//AskToEndorse();
|
//AskToEndorse();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void InctallIncludedDownloadMetas()
|
||||||
|
{
|
||||||
|
ModList.Directives
|
||||||
|
.OfType<ArchiveMeta>()
|
||||||
|
.PMap(directive =>
|
||||||
|
{
|
||||||
|
Status($"Writing included .meta file {directive.To}");
|
||||||
|
var out_path = Path.Combine(DownloadFolder, directive.To);
|
||||||
|
if (File.Exists(out_path)) File.Delete(out_path);
|
||||||
|
File.WriteAllBytes(out_path, LoadBytesFromPath(directive.SourceDataID));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
private void ValidateGameESMs()
|
private void ValidateGameESMs()
|
||||||
{
|
{
|
||||||
foreach (var esm in ModList.Directives.OfType<CleanedESM>().ToList())
|
foreach (var esm in ModList.Directives.OfType<CleanedESM>().ToList())
|
||||||
|
@ -63,6 +63,17 @@ namespace Wabbajack.Test
|
|||||||
var modlist = CompileAndInstall(profile);
|
var modlist = CompileAndInstall(profile);
|
||||||
|
|
||||||
utils.VerifyAllFiles();
|
utils.VerifyAllFiles();
|
||||||
|
|
||||||
|
Directory.Delete(Path.Combine(utils.InstallFolder, "LOOT Config Files"), true);
|
||||||
|
|
||||||
|
VirtualFileSystem.Reconfigure(utils.TestFolder);
|
||||||
|
var compiler = new Compiler(utils.InstallFolder);
|
||||||
|
compiler.MO2DownloadsFolder = Path.Combine(utils.DownloadsFolder);
|
||||||
|
compiler.VFS.Reset();
|
||||||
|
compiler.MO2Profile = profile;
|
||||||
|
compiler.ShowReportWhenFinished = false;
|
||||||
|
Assert.IsTrue(compiler.Compile());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DownloadAndInstall(string url, string filename, string mod_name = null)
|
private void DownloadAndInstall(string url, string filename, string mod_name = null)
|
||||||
|
@ -50,6 +50,7 @@ namespace Wabbajack.Test
|
|||||||
"[General]",
|
"[General]",
|
||||||
$"gameName={GameName}",
|
$"gameName={GameName}",
|
||||||
$"gamePath={GameFolder.Replace("\\", "\\\\")}",
|
$"gamePath={GameFolder.Replace("\\", "\\\\")}",
|
||||||
|
$"download_directory={DownloadsFolder}"
|
||||||
});
|
});
|
||||||
|
|
||||||
Directory.CreateDirectory(DownloadsFolder);
|
Directory.CreateDirectory(DownloadsFolder);
|
||||||
|
Loading…
Reference in New Issue
Block a user