Skip to content

Commit e831184

Browse files
committed
[.NET] Fix string.PathJoin to be consistent with core
1 parent 7b9c512 commit e831184

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

modules/mono/glue/GodotSharp/GodotSharp/Core/StringExtensions.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1315,7 +1315,9 @@ public static string PadZeros(this string instance, int digits)
13151315
/// <returns>The concatenated path with the given file name.</returns>
13161316
public static string PathJoin(this string instance, string file)
13171317
{
1318-
if (instance.Length > 0 && instance[instance.Length - 1] == '/')
1318+
if (instance.Length == 0)
1319+
return file;
1320+
if (instance[^1] == '/' || (file.Length > 0 && file[0] == '/'))
13191321
return instance + file;
13201322
return instance + "/" + file;
13211323
}

0 commit comments

Comments
 (0)