mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Make everything use Path.Combine instead of concat for Linux
This commit is contained in:
parent
e5bc06dace
commit
126547be6f
@ -87,7 +87,7 @@ namespace NewHorizons.Builder.Props
|
||||
|
||||
var dialogueTree = conversationZone.AddComponent<CharacterDialogueTree>();
|
||||
|
||||
var xml = File.ReadAllText(mod.Manifest.ModFolderPath + info.xmlFile);
|
||||
var xml = File.ReadAllText(Path.Combine(mod.Manifest.ModFolderPath, info.xmlFile));
|
||||
var text = new TextAsset(xml);
|
||||
|
||||
// Text assets need a name to be used with VoiceMod
|
||||
|
||||
@ -2,12 +2,12 @@ using NewHorizons.External.Modules;
|
||||
using NewHorizons.Handlers;
|
||||
using NewHorizons.Utility;
|
||||
using OWML.Common;
|
||||
using Enum = System.Enum;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Xml;
|
||||
using UnityEngine;
|
||||
using Enum = System.Enum;
|
||||
using Logger = NewHorizons.Utility.Logger;
|
||||
using Random = UnityEngine.Random;
|
||||
namespace NewHorizons.Builder.Props
|
||||
@ -108,7 +108,7 @@ namespace NewHorizons.Builder.Props
|
||||
{
|
||||
if (_scrollPrefab == null) InitPrefabs();
|
||||
|
||||
var xmlPath = File.ReadAllText(mod.ModHelper.Manifest.ModFolderPath + info.xmlFile);
|
||||
var xmlPath = File.ReadAllText(Path.Combine(mod.ModHelper.Manifest.ModFolderPath, info.xmlFile));
|
||||
|
||||
switch (info.type)
|
||||
{
|
||||
|
||||
@ -4,6 +4,7 @@ using NewHorizons.Utility;
|
||||
using OWML.Common;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using UnityEngine;
|
||||
using static NewHorizons.External.Modules.PropModule;
|
||||
@ -346,8 +347,7 @@ namespace NewHorizons.Builder.Props
|
||||
}
|
||||
else
|
||||
{
|
||||
// Don't use Path.Combine here else you break the Vision
|
||||
imageLoader.PathsToLoad.Add((i, mod.ModHelper.Manifest.ModFolderPath + slideInfo.imagePath));
|
||||
imageLoader.PathsToLoad.Add((i, Path.Combine(mod.ModHelper.Manifest.ModFolderPath, slideInfo.imagePath)));
|
||||
}
|
||||
|
||||
AddModules(slideInfo, ref slide, mod);
|
||||
|
||||
@ -4,6 +4,7 @@ using NewHorizons.Handlers;
|
||||
using NewHorizons.Utility;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Xml.Linq;
|
||||
using UnityEngine;
|
||||
using Logger = NewHorizons.Utility.Logger;
|
||||
@ -53,7 +54,7 @@ namespace NewHorizons.Builder.ShipLog
|
||||
public static void AddBodyToShipLog(ShipLogManager manager, NewHorizonsBody body)
|
||||
{
|
||||
string systemName = body.Config.starSystem;
|
||||
XElement astroBodyFile = XElement.Load(body.Mod.ModHelper.Manifest.ModFolderPath + "/" + body.Config.ShipLog.xmlFile);
|
||||
XElement astroBodyFile = XElement.Load(Path.Combine(body.Mod.ModHelper.Manifest.ModFolderPath, body.Config.ShipLog.xmlFile));
|
||||
XElement astroBodyId = astroBodyFile.Element("ID");
|
||||
if (astroBodyId == null)
|
||||
{
|
||||
|
||||
@ -2,6 +2,7 @@ using NewHorizons.Utility;
|
||||
using OWML.Common;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
using Logger = NewHorizons.Utility.Logger;
|
||||
@ -65,7 +66,7 @@ namespace NewHorizons.Handlers
|
||||
var id = mod.ModHelper.Manifest.UniqueName + "_" + audioPath;
|
||||
if (_customAudioTypes.TryGetValue(id, out audioType)) return audioType;
|
||||
|
||||
var audioClip = AudioUtilities.LoadAudio(mod.ModHelper.Manifest.ModFolderPath + "/" + audioPath);
|
||||
var audioClip = AudioUtilities.LoadAudio(Path.Combine(mod.ModHelper.Manifest.ModFolderPath, audioPath));
|
||||
|
||||
if (audioClip == null)
|
||||
{
|
||||
|
||||
@ -167,7 +167,7 @@ namespace NewHorizons
|
||||
TextTranslation.Get().SetLanguage(TextTranslation.Get().GetLanguage());
|
||||
}
|
||||
|
||||
LoadTranslations(Instance.ModHelper.Manifest.ModFolderPath + "Assets/", this);
|
||||
LoadTranslations(Path.Combine(Instance.ModHelper.Manifest.ModFolderPath, "Assets/"), this);
|
||||
}
|
||||
|
||||
public void Awake()
|
||||
|
||||
@ -36,10 +36,10 @@ namespace NewHorizons
|
||||
if (name == null) return;
|
||||
|
||||
var relativePath = $"temp/{name}.json";
|
||||
var fullPath = Main.Instance.ModHelper.Manifest.ModFolderPath + relativePath;
|
||||
if (!Directory.Exists(Main.Instance.ModHelper.Manifest.ModFolderPath + "temp"))
|
||||
var fullPath = Path.Combine(Main.Instance.ModHelper.Manifest.ModFolderPath, relativePath);
|
||||
if (!Directory.Exists(Path.Combine(Main.Instance.ModHelper.Manifest.ModFolderPath, "temp")))
|
||||
{
|
||||
Directory.CreateDirectory(Main.Instance.ModHelper.Manifest.ModFolderPath + "temp");
|
||||
Directory.CreateDirectory(Path.Combine(Main.Instance.ModHelper.Manifest.ModFolderPath, "temp"));
|
||||
}
|
||||
JsonHelper.SaveJsonObject(fullPath, config);
|
||||
var body = Main.Instance.LoadConfig(Main.Instance, relativePath);
|
||||
@ -126,7 +126,7 @@ namespace NewHorizons
|
||||
var planet = Main.BodyDict[Main.Instance.CurrentStarSystem].Find((b) => b.Config.name == bodyName);
|
||||
return planet == null
|
||||
? null
|
||||
: QueryJson(outType, planet.Mod.ModHelper.Manifest.ModFolderPath + planet.RelativePath, jsonPath);
|
||||
: QueryJson(outType, Path.Combine(planet.Mod.ModHelper.Manifest.ModFolderPath, planet.RelativePath), jsonPath);
|
||||
}
|
||||
|
||||
public object QuerySystem(Type outType, string jsonPath)
|
||||
@ -134,7 +134,7 @@ namespace NewHorizons
|
||||
var system = Main.SystemDict[Main.Instance.CurrentStarSystem];
|
||||
return system == null
|
||||
? null
|
||||
: QueryJson(outType, system.Mod.ModHelper.Manifest.ModFolderPath + system.RelativePath, jsonPath);
|
||||
: QueryJson(outType, Path.Combine(system.Mod.ModHelper.Manifest.ModFolderPath, system.RelativePath), jsonPath);
|
||||
}
|
||||
|
||||
public GameObject SpawnObject(GameObject planet, Sector sector, string propToCopyPath, Vector3 position, Vector3 eulerAngles,
|
||||
|
||||
@ -38,10 +38,10 @@ namespace NewHorizons.OtherMods.VoiceActing
|
||||
{
|
||||
foreach (var mod in Main.Instance.GetDependants().Append(Main.Instance))
|
||||
{
|
||||
var folder = $"{mod.ModHelper.Manifest.ModFolderPath}voicemod";
|
||||
var folder = Path.Combine(mod.ModHelper.Manifest.ModFolderPath, "voicemod");
|
||||
if (!Directory.Exists(folder)) {
|
||||
// Fallback to PascalCase bc it used to be like that
|
||||
folder = $"{mod.ModHelper.Manifest.ModFolderPath}VoiceMod";
|
||||
folder = Path.Combine(mod.ModHelper.Manifest.ModFolderPath, "VoiceMod");
|
||||
}
|
||||
if (Directory.Exists(folder))
|
||||
{
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
using OWML.Common;
|
||||
using OWML.Common;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
@ -34,7 +34,7 @@ namespace NewHorizons.Utility
|
||||
}
|
||||
else
|
||||
{
|
||||
var completePath = mod.ModHelper.Manifest.ModFolderPath + assetBundleRelativeDir;
|
||||
var completePath = Path.Combine(mod.ModHelper.Manifest.ModFolderPath, assetBundleRelativeDir);
|
||||
bundle = AssetBundle.LoadFromFile(completePath);
|
||||
if (bundle == null)
|
||||
{
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
using OWML.Common;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
@ -19,7 +20,7 @@ namespace NewHorizons.Utility
|
||||
{
|
||||
try
|
||||
{
|
||||
var clip = LoadAudio(mod.ModHelper.Manifest.ModFolderPath + "/" + audio);
|
||||
var clip = LoadAudio(Path.Combine(mod.ModHelper.Manifest.ModFolderPath, audio));
|
||||
source._audioLibraryClip = AudioType.None;
|
||||
source._clipArrayIndex = 0;
|
||||
source._clipArrayLength = 0;
|
||||
|
||||
@ -210,7 +210,7 @@ namespace NewHorizons.Utility.DebugMenu
|
||||
continue;
|
||||
}
|
||||
|
||||
loadedConfigFiles[folder + body.RelativePath] = body.Config;
|
||||
loadedConfigFiles[Path.Combine(folder, body.RelativePath)] = body.Config;
|
||||
submenus.ForEach(submenu => submenu.LoadConfigFile(this, body.Config));
|
||||
}
|
||||
}
|
||||
@ -235,9 +235,9 @@ namespace NewHorizons.Utility.DebugMenu
|
||||
|
||||
try
|
||||
{
|
||||
var path = loadedMod.ModHelper.Manifest.ModFolderPath + backupFolderName + relativePath;
|
||||
var path = Path.Combine(loadedMod.ModHelper.Manifest.ModFolderPath, backupFolderName, relativePath);
|
||||
Logger.LogVerbose($"Backing up... {relativePath} to {path}");
|
||||
var oldPath = loadedMod.ModHelper.Manifest.ModFolderPath + relativePath;
|
||||
var oldPath = Path.Combine(loadedMod.ModHelper.Manifest.ModFolderPath, relativePath);
|
||||
var directoryName = Path.GetDirectoryName(path);
|
||||
Directory.CreateDirectory(directoryName);
|
||||
|
||||
@ -254,7 +254,7 @@ namespace NewHorizons.Utility.DebugMenu
|
||||
try
|
||||
{
|
||||
Logger.Log($"Saving... {relativePath} to {filePath}");
|
||||
var path = loadedMod.ModHelper.Manifest.ModFolderPath + relativePath;
|
||||
var path = Path.Combine(loadedMod.ModHelper.Manifest.ModFolderPath, relativePath);
|
||||
var directoryName = Path.GetDirectoryName(path);
|
||||
Directory.CreateDirectory(directoryName);
|
||||
|
||||
|
||||
@ -17,14 +17,14 @@ namespace NewHorizons.Utility
|
||||
|
||||
public static bool IsTextureLoaded(IModBehaviour mod, string filename)
|
||||
{
|
||||
var path = mod.ModHelper.Manifest.ModFolderPath + filename;
|
||||
var path = Path.Combine(mod.ModHelper.Manifest.ModFolderPath, filename);
|
||||
return _loadedTextures.ContainsKey(path);
|
||||
}
|
||||
|
||||
public static Texture2D GetTexture(IModBehaviour mod, string filename, bool useMipmaps = true, bool wrap = false)
|
||||
{
|
||||
// Copied from OWML but without the print statement lol
|
||||
var path = mod.ModHelper.Manifest.ModFolderPath + filename;
|
||||
var path = Path.Combine(mod.ModHelper.Manifest.ModFolderPath, filename);
|
||||
if (_loadedTextures.ContainsKey(path))
|
||||
{
|
||||
Logger.LogVerbose($"Already loaded image at path: {path}");
|
||||
@ -53,7 +53,7 @@ namespace NewHorizons.Utility
|
||||
|
||||
public static void DeleteTexture(IModBehaviour mod, string filename, Texture2D texture)
|
||||
{
|
||||
var path = mod.ModHelper.Manifest.ModFolderPath + filename;
|
||||
var path = Path.Combine(mod.ModHelper.Manifest.ModFolderPath, filename);
|
||||
if (_loadedTextures.ContainsKey(path))
|
||||
{
|
||||
if (_loadedTextures[path] == texture)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user