From aaf93477d05d4487c1a987a34a49bdd31b437955 Mon Sep 17 00:00:00 2001 From: Jarrod Doyle Date: Wed, 7 Aug 2024 18:40:46 +0100 Subject: [PATCH] Fix incorrect paths for textures relative to mission file --- project/code/Mission.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/project/code/Mission.cs b/project/code/Mission.cs index 48b3d0b..bea09a7 100644 --- a/project/code/Mission.cs +++ b/project/code/Mission.cs @@ -371,6 +371,7 @@ public partial class Mission : Node3D private void LoadTextures(TxList textureList) { // TODO: This has hardcoded .png extension and relies on you placing extracted and converted images in godot user directory + // TODO: Use PathJoin var count = textureList.ItemCount; for (var i = 0; i < count; i++) { @@ -388,9 +389,11 @@ public partial class Mission : Node3D } path += item.Name + ".png"; // Hardcoded extension! - if (File.Exists(FileName + path)) + // TODO: It's case sensitive :) + var fmFamPath = Path.GetDirectoryName(FileName).PathJoin(path); + if (File.Exists(fmFamPath)) { - path = FileName + path; + path = fmFamPath; } else if (File.Exists(ProjectSettings.GlobalizePath($"user://textures{path}"))) { @@ -398,6 +401,7 @@ public partial class Mission : Node3D } else { + GD.Print($"Failed to find texture: {path}"); path = "user://textures/jorge.png"; }