From 2e759523e7a237627c5928512a8e55f94aeee02b Mon Sep 17 00:00:00 2001 From: JohnCorby Date: Tue, 18 Oct 2022 00:32:33 -0700 Subject: [PATCH 1/2] do fixBackslashes: false on Storage.Load --- NewHorizons/External/NewHorizonsData.cs | 2 +- NewHorizons/Main.cs | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/NewHorizons/External/NewHorizonsData.cs b/NewHorizons/External/NewHorizonsData.cs index 52a8cbf1..2a2c8c5d 100644 --- a/NewHorizons/External/NewHorizonsData.cs +++ b/NewHorizons/External/NewHorizonsData.cs @@ -25,7 +25,7 @@ namespace NewHorizons.External try { - _saveFile = Main.Instance.ModHelper.Storage.Load(FileName); + _saveFile = Main.Instance.ModHelper.Storage.Load(FileName, false); if (!_saveFile.Profiles.ContainsKey(_activeProfileName)) _saveFile.Profiles.Add(_activeProfileName, new NewHorizonsProfile()); _activeProfile = _saveFile.Profiles[_activeProfileName]; diff --git a/NewHorizons/Main.cs b/NewHorizons/Main.cs index dc72b08d..4f74a553 100644 --- a/NewHorizons/Main.cs +++ b/NewHorizons/Main.cs @@ -582,7 +582,7 @@ namespace NewHorizons Logger.LogVerbose($"Loading system {name}"); var relativePath = file.Replace(folder, ""); - var starSystemConfig = mod.ModHelper.Storage.Load(relativePath); + var starSystemConfig = mod.ModHelper.Storage.Load(relativePath, false); starSystemConfig.Migrate(); starSystemConfig.FixCoordinates(); @@ -656,7 +656,7 @@ namespace NewHorizons { Logger.LogVerbose($"Loading addon manifest for {mod.ModHelper.Manifest.Name}"); - var addonConfig = mod.ModHelper.Storage.Load(file); + var addonConfig = mod.ModHelper.Storage.Load(file, false); if (addonConfig.achievements != null) { @@ -706,7 +706,7 @@ namespace NewHorizons NewHorizonsBody body = null; try { - var config = mod.ModHelper.Storage.Load(relativePath); + var config = mod.ModHelper.Storage.Load(relativePath, false); if (config == null) { Logger.LogError($"Couldn't load {relativePath}. Is your Json formatted correctly?"); @@ -719,7 +719,7 @@ namespace NewHorizons if (!SystemDict.ContainsKey(config.starSystem)) { // Since we didn't load it earlier there shouldn't be a star system config - var starSystemConfig = mod.ModHelper.Storage.Load($"systems/{config.starSystem}.json"); + var starSystemConfig = mod.ModHelper.Storage.Load(Path.Combine("systems", config.starSystem + ".json"), false); if (starSystemConfig == null) starSystemConfig = new StarSystemConfig(); else Logger.LogWarning($"Loaded system config for {config.starSystem}. Why wasn't this loaded earlier?"); From bb4e7fca2afe6b3f839b3b772e9caafeb1b20bbd Mon Sep 17 00:00:00 2001 From: JohnCorby Date: Tue, 18 Oct 2022 00:40:51 -0700 Subject: [PATCH 2/2] use Path.Combine here too --- NewHorizons/Components/ShipLog/ShipLogStarChartMode.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/NewHorizons/Components/ShipLog/ShipLogStarChartMode.cs b/NewHorizons/Components/ShipLog/ShipLogStarChartMode.cs index f7788542..03510628 100644 --- a/NewHorizons/Components/ShipLog/ShipLogStarChartMode.cs +++ b/NewHorizons/Components/ShipLog/ShipLogStarChartMode.cs @@ -2,6 +2,7 @@ using NewHorizons.Handlers; using NewHorizons.Utility; using System; using System.Collections.Generic; +using System.IO; using System.Linq; using UnityEngine; using UnityEngine.UI; @@ -131,7 +132,7 @@ namespace NewHorizons.Components.ShipLog } else { - var path = $"planets/{uniqueID}.png"; + var path = Path.Combine("planets", uniqueID + ".png"); Logger.LogVerbose($"ShipLogStarChartManager - Trying to load {path}"); texture = ImageUtilities.GetTexture(Main.SystemDict[uniqueID].Mod, path); }