summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2020-09-23 18:12:27 +0200
committerGitHub <noreply@github.com>2020-09-23 18:12:27 +0200
commit72aaf81518253e25f28b3a23b5d3509e1264a5ad (patch)
treec85c2225bbcb22ade78c2293cf53f719cf31ae6f
parent215fa6e85b8a22e75081190293460f720291f6a5 (diff)
parentb5eea5cfd426115969d3382505a508cc866959ba (diff)
Merge pull request #42259 from zaevi/fix-mono-IsAbsPath
Fix C# string.IsAbsPath()
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/StringExtensions.cs9
1 files 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 9421a24b34..bd1dbc1229 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/StringExtensions.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/StringExtensions.cs
@@ -440,7 +440,12 @@ namespace Godot
// </summary>
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] == '\\';
}
// <summary>
@@ -448,7 +453,7 @@ namespace Godot
// </summary>
public static bool IsRelPath(this string instance)
{
- return !System.IO.Path.IsPathRooted(instance);
+ return !IsAbsPath(instance);
}
// <summary>