more path.combine (#405)

self explanatory (use it more)
This commit is contained in:
Nick 2022-09-30 23:58:54 -04:00 committed by GitHub
commit 12d0d102f9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 7 deletions

View File

@ -1,4 +1,5 @@
{
"$schema": "https://raw.githubusercontent.com/Outer-Wilds-New-Horizons/new-horizons/main/NewHorizons/Schemas/addon_manifest_schema.json",
"credits": [
"xen#Mod Director\n#Programmer",
"Bwc9876#Mod Manager\n#Programmer\n#Dev Ops",

View File

@ -206,7 +206,7 @@ namespace NewHorizons.Builder.ShipLog
private static Sprite GetEntrySprite(string entryId, NewHorizonsBody body, bool logError)
{
string relativePath = body.Config.ShipLog.spriteFolder + "/" + entryId + ".png";
string relativePath = Path.Combine(body.Config.ShipLog.spriteFolder, entryId + ".png");
try
{
Texture2D newTexture = ImageUtilities.GetTexture(body.Mod, relativePath);

View File

@ -571,11 +571,11 @@ namespace NewHorizons
}
}
// Has to go before translations for achievements
if (File.Exists(folder + "addon-manifest.json"))
if (File.Exists(Path.Combine(folder, "addon-manifest.json")))
{
LoadAddonManifest("addon-manifest.json", mod);
}
if (Directory.Exists(folder + @"translations\"))
if (Directory.Exists(Path.Combine(folder, "translations")))
{
LoadTranslations(folder, mod);
}
@ -603,15 +603,15 @@ namespace NewHorizons
var foundFile = false;
foreach (TextTranslation.Language language in Enum.GetValues(typeof(TextTranslation.Language)))
{
if (language == TextTranslation.Language.UNKNOWN || language == TextTranslation.Language.TOTAL) continue;
if (language is TextTranslation.Language.UNKNOWN or TextTranslation.Language.TOTAL) continue;
var relativeFile = $"translations/{language.ToString().ToLower()}.json";
var relativeFile = Path.Combine("translations", language.ToString().ToLower() + ".json");
if (File.Exists($"{folder}{relativeFile}"))
if (File.Exists(Path.Combine(folder, relativeFile)))
{
Logger.LogVerbose($"Registering {language} translation from {mod.ModHelper.Manifest.Name} from {relativeFile}");
var config = new TranslationConfig($"{folder}{relativeFile}");
var config = new TranslationConfig(Path.Combine(folder, relativeFile));
foundFile = true;