From c189482f67431e417821a665543230d5c7963d8a Mon Sep 17 00:00:00 2001 From: xen-42 Date: Sun, 27 Oct 2024 16:11:03 -0400 Subject: [PATCH] Fall back to file name before validating also dont call migrate twice --- NewHorizons/External/NewHorizonBody.cs | 8 -------- NewHorizons/Main.cs | 6 ++++++ 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/NewHorizons/External/NewHorizonBody.cs b/NewHorizons/External/NewHorizonBody.cs index 79fef54d..2016d8d0 100644 --- a/NewHorizons/External/NewHorizonBody.cs +++ b/NewHorizons/External/NewHorizonBody.cs @@ -16,14 +16,6 @@ namespace NewHorizons.External Config = config; Mod = mod; RelativePath = relativePath; - - // Fall back to file name if name not given - if (!string.IsNullOrEmpty(relativePath) && string.IsNullOrEmpty(config.name)) - { - config.name = Path.GetFileNameWithoutExtension(relativePath); - } - - Migrate(); } public PlanetConfig Config; diff --git a/NewHorizons/Main.cs b/NewHorizons/Main.cs index 41827310..97b861ab 100644 --- a/NewHorizons/Main.cs +++ b/NewHorizons/Main.cs @@ -922,6 +922,12 @@ namespace NewHorizons BodyDict.Add(config.starSystem, new List()); } + // Fall back to file name if name not given + if (!string.IsNullOrEmpty(relativePath) && string.IsNullOrEmpty(config.name)) + { + config.name = Path.GetFileNameWithoutExtension(relativePath); + } + // Has to happen after we make sure theres a system config config.Validate(); config.Migrate();