Merge pull request #292 from erri120/vortex-fixes-7

Deployment files are now included correctly
This commit is contained in:
Timothy Baldridge 2019-12-18 08:09:54 -07:00 committed by GitHub
commit 381b70a8df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 22 additions and 8 deletions

View File

@ -1,5 +1,8 @@
using System.IO;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Wabbajack.Common;
namespace Wabbajack.Lib.CompilationSteps
{
@ -11,10 +14,21 @@ namespace Wabbajack.Lib.CompilationSteps
public override async ValueTask<Directive> Run(RawSourceFile source)
{
if (!source.Path.EndsWith("vortex.deployment.msgpack") &&
!source.Path.EndsWith("\\vortex.deployment.json") && Path.GetExtension(source.Path) != ".meta") return null;
var l = new List<string> {"vortex.deployment.msgpack", "vortex.deployment.json"};
if (!l.Any(a => source.Path.Contains(a))) return null;
var inline = source.EvolveTo<InlineFile>();
inline.SourceDataID = _compiler.IncludeFile(File.ReadAllBytes(source.AbsolutePath));
if (!source.Path.Contains("vortex.deployment.json"))
return inline;
var path = source.Path;
if (!path.StartsWith(Consts.GameFolderFilesDir))
return inline;
path = path.Substring(Consts.GameFolderFilesDir.Length + 1);
path = $"{Consts.ManualGameFilesDir}\\{path}";
inline.To = path;
return inline;
}

View File

@ -116,7 +116,7 @@ namespace Wabbajack.Lib
UpdateTracker.NextStep("Finding Install Files");
var vortexStagingFiles = Directory.EnumerateFiles(StagingFolder, "*", SearchOption.AllDirectories)
.Where(p => p.FileExists() && p != StagingMarkerName)
.Where(p => p.FileExists() && p != StagingMarkerName && !p.Contains(Consts.ManualGameFilesDir))
.Select(p => new RawSourceFile(VFS.Index.ByRootPath[p])
{Path = p.RelativeTo(StagingFolder)});
@ -470,12 +470,12 @@ namespace Wabbajack.Lib
return new List<ICompilationStep>
{
new IncludePropertyFiles(this),
new IncludeVortexDeployment(this),
new IncludeSteamWorkshopItems(this, _steamGame),
_hasSteamWorkshopItems ? new IncludeRegex(this, "^steamWorkshopItem_\\d*\\.meta$") : null,
new IgnoreDisabledVortexMods(this),
new IncludeVortexDeployment(this),
new IgnoreVortex(this),
new IgnoreRegex(this, $"^*{StagingMarkerName}$"),

View File

@ -132,14 +132,14 @@ namespace Wabbajack.Lib
var dirInfo = new DirectoryInfo(dir);
dirInfo.GetDirectories("*", SearchOption.AllDirectories).Do(d =>
{
var destPath = d.FullName.Replace(dir, gameFolder);
var destPath = d.FullName.Replace(manualFilesDir, gameFolder);
Status($"Creating directory {destPath}");
Directory.CreateDirectory(destPath);
});
dirInfo.GetFiles("*", SearchOption.AllDirectories).Do(f =>
{
var destPath = f.FullName.Replace(dir, gameFolder);
var destPath = f.FullName.Replace(manualFilesDir, gameFolder);
Status($"Copying file {f.FullName} to {destPath}");
try
{
@ -207,7 +207,7 @@ namespace Wabbajack.Lib
if (directive.To.EndsWith(".meta"))
return;
Status($"Writing included file {directive.To}");
Info($"Writing included file {directive.To}");
var outPath = Path.Combine(OutputFolder, directive.To);
if(File.Exists(outPath)) File.Delete(outPath);
File.WriteAllBytes(outPath, LoadBytesFromPath(directive.SourceDataID));