diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/StringExtensions.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/StringExtensions.cs index d1a829fe82..3fadfda0a3 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/StringExtensions.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/StringExtensions.cs @@ -1315,7 +1315,9 @@ namespace Godot /// The concatenated path with the given file name. public static string PathJoin(this string instance, string file) { - if (instance.Length > 0 && instance[instance.Length - 1] == '/') + if (instance.Length == 0) + return file; + if (instance[^1] == '/' || (file.Length > 0 && file[0] == '/')) return instance + file; return instance + "/" + file; }