Merge pull request #42259 from zaevi/fix-mono-IsAbsPath

Fix C# string.IsAbsPath()
This commit is contained in:
Rémi Verschelde 2020-09-23 18:12:27 +02:00 committed by GitHub
commit 72aaf81518
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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>