From e5b357cfb1f1cb9bb27049cbdab56b739a6bdef7 Mon Sep 17 00:00:00 2001 From: Zae Date: Wed, 23 Sep 2020 13:10:27 +0800 Subject: [PATCH] Fix C# string.IsAbsPath() (cherry picked from commit b5eea5cfd426115969d3382505a508cc866959ba) --- .../glue/GodotSharp/GodotSharp/Core/StringExtensions.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/StringExtensions.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/StringExtensions.cs index 12444ac1296..5d328e106cc 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/StringExtensions.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/StringExtensions.cs @@ -448,7 +448,12 @@ namespace Godot // public static bool IsAbsPath(this string instance) { - return System.IO.Path.IsPathRooted(instance); + if (string.IsNullOrEmpty(instance)) + return false; + else if (instance.Length > 1) + return instance[0] == '/' || instance[0] == '\\' || instance.Contains(":/") || instance.Contains(":\\"); + else + return instance[0] == '/' || instance[0] == '\\'; } // @@ -456,7 +461,7 @@ namespace Godot // public static bool IsRelPath(this string instance) { - return !System.IO.Path.IsPathRooted(instance); + return !IsAbsPath(instance); } //