Compiler fixes

This commit is contained in:
Timothy Baldridge 2022-05-28 16:53:52 -06:00
parent 06bb04c89f
commit 550d744b07
6 changed files with 23 additions and 10 deletions

View File

@ -7,6 +7,7 @@ using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using Wabbajack.Common;
using Wabbajack.Compiler;
using Wabbajack.Downloaders;
using Wabbajack.Downloaders.GameFile;
@ -61,7 +62,7 @@ public class InstallCompileInstallVerify : IVerb
foreach (var machineUrl in machineUrls)
{
_logger.LogInformation("Installing {MachineUrl}", machineUrl);
var wabbajackPath = downloads.Combine(machineUrl.Replace("/", "_@@_"));
var wabbajackPath = downloads.Combine(machineUrl.Replace("/", "_@@_")).WithExtension(Ext.Wabbajack);
if (!await DownloadMachineUrl(machineUrl, wabbajackPath, token))
throw new Exception("Can't download modlist");
@ -86,6 +87,7 @@ public class InstallCompileInstallVerify : IVerb
return 1;
}
_logger.LogInformation("Inferring settings");
var inferedSettings = await _inferencer.InferFromRootPath(installPath);
if (inferedSettings == null)

View File

@ -310,7 +310,7 @@ public abstract class ACompiler
catch (Exception e)
{
_logger.LogCritical(e, $"Exception while checking meta {filename}");
return false;
return true;
}
}

View File

@ -100,7 +100,7 @@ public class HttpDownloader : ADownloader<DTOs.DownloadStates.Http>, IUrlDownloa
{
var msg = MakeMessage(state);
return await _client.SendAsync(msg, token);
return await _client.SendAsync(msg, HttpCompletionOption.ResponseHeadersRead, token);
}
internal static HttpRequestMessage MakeMessage(DTOs.DownloadStates.Http state)

View File

@ -222,7 +222,8 @@ public class StandardInstaller : AInstaller<StandardInstaller>
if (HashedArchives.TryGetValue(archive.Hash, out var paths))
{
var metaPath = paths.WithExtension(Ext.Meta);
if (!metaPath.FileExists() && archive.State is not GameFileSource)
if (archive.State is GameFileSource) return;
if (!metaPath.FileExists())
{
var meta = AddInstalled(_downloadDispatcher.MetaIni(archive));
await metaPath.WriteAllLinesAsync(meta, token);
@ -233,10 +234,12 @@ public class StandardInstaller : AInstaller<StandardInstaller>
private IEnumerable<string> AddInstalled(IEnumerable<string> getMetaIni)
{
yield return "[General]";
yield return "installed=true";
foreach (var f in getMetaIni)
{
yield return f;
if (f == "[General]") yield return "installed=true";
}
}

View File

@ -10,12 +10,13 @@ public enum PathFormat : byte
Unix
}
public readonly struct AbsolutePath : IPath, IComparable<AbsolutePath>, IEquatable<AbsolutePath>
public struct AbsolutePath : IPath, IComparable<AbsolutePath>, IEquatable<AbsolutePath>
{
public static readonly AbsolutePath Empty = "".ToAbsolutePath();
public PathFormat PathFormat { get; }
private int _hashCode = 0;
internal readonly string[] Parts;
public Extension Extension => Extension.FromPath(Parts[^1]);
@ -93,8 +94,10 @@ public readonly struct AbsolutePath : IPath, IComparable<AbsolutePath>, IEquatab
public override int GetHashCode()
{
return Parts.Aggregate(0,
if (_hashCode != 0) return _hashCode;
_hashCode = Parts.Aggregate(0,
(current, part) => current ^ part.GetHashCode(StringComparison.CurrentCultureIgnoreCase));
return _hashCode;
}
public override bool Equals(object? obj)

View File

@ -3,10 +3,12 @@ using System.Linq;
namespace Wabbajack.Paths;
public readonly struct RelativePath : IPath, IEquatable<RelativePath>, IComparable<RelativePath>
public struct RelativePath : IPath, IEquatable<RelativePath>, IComparable<RelativePath>
{
internal readonly string[] Parts;
private int _hashCode = 0;
internal RelativePath(string[] parts)
{
Parts = parts;
@ -79,8 +81,11 @@ public readonly struct RelativePath : IPath, IEquatable<RelativePath>, IComparab
public override int GetHashCode()
{
return Parts.Aggregate(0,
if (_hashCode != 0) return _hashCode;
_hashCode = Parts.Aggregate(0,
(current, part) => current ^ part.GetHashCode(StringComparison.CurrentCultureIgnoreCase));
return _hashCode;
}
public bool Equals(RelativePath other)