From e2b3030ef55c61038c78fc6ab3b5830cb1c763fc Mon Sep 17 00:00:00 2001 From: wincent Date: Mon, 31 Jan 2022 17:30:59 +0100 Subject: [PATCH] Fixed path irregularities and added option to specify an explicit id --- InfectedRose.Interface/Mod.cs | 3 +++ InfectedRose.Interface/ModContext.cs | 13 ++++++++++--- InfectedRose.Interface/Program.cs | 4 +--- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/InfectedRose.Interface/Mod.cs b/InfectedRose.Interface/Mod.cs index d14f656..cac72ca 100644 --- a/InfectedRose.Interface/Mod.cs +++ b/InfectedRose.Interface/Mod.cs @@ -10,6 +10,9 @@ namespace InfectedRose.Interface { [JsonPropertyName("id")] public string Id { get; set; } = ""; + + [JsonPropertyName("explicit-id")] + public int? ExplicitId { get; set; } [JsonPropertyName("old-ids")] public string[]? OldIds { get; set; } diff --git a/InfectedRose.Interface/ModContext.cs b/InfectedRose.Interface/ModContext.cs index 488c3b4..34c16df 100644 --- a/InfectedRose.Interface/ModContext.cs +++ b/InfectedRose.Interface/ModContext.cs @@ -171,7 +171,14 @@ namespace InfectedRose.Interface return true; } + + if (mod.ExplicitId.HasValue) + { + key = mod.ExplicitId.Value; + return true; + } + if (mod.OldIds == null) { key = 0; @@ -185,7 +192,7 @@ namespace InfectedRose.Interface return true; } - + key = 0; return false; @@ -261,8 +268,8 @@ namespace InfectedRose.Interface // Get the relative path from root to asset var finalRelative = Path.GetRelativePath(root, final); - - return finalRelative.Replace("/", "\\"); + + return finalRelative; } public static int AddIcon(string file) diff --git a/InfectedRose.Interface/Program.cs b/InfectedRose.Interface/Program.cs index 32eeb71..1c7b89a 100644 --- a/InfectedRose.Interface/Program.cs +++ b/InfectedRose.Interface/Program.cs @@ -667,11 +667,9 @@ namespace InfectedRose.Interface if (Directory.Exists(ModContext.Configuration.Copy)) { Directory.Delete(ModContext.Configuration.Copy, true); - - Directory.CreateDirectory(ModContext.Configuration.Copy); } - CopyFilesRecursively(ModContext.Root, ModContext.Configuration.Copy); + File.CreateSymbolicLink(ModContext.Configuration.Copy, ModContext.Root); } origin = Console.GetCursorPosition();