Fall back to file name before validating also dont call migrate twice

This commit is contained in:
xen-42 2024-10-27 16:11:03 -04:00
parent 9408fd43f8
commit c189482f67
2 changed files with 6 additions and 8 deletions

View File

@ -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;

View File

@ -922,6 +922,12 @@ namespace NewHorizons
BodyDict.Add(config.starSystem, new List<NewHorizonsBody>());
}
// 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();