Fix String.GetExtension() return value.
It previously returned the string itself when it should return an empty string according to the docs/examples and the C++ counterpart String::get_extension().
This commit is contained in:
@ -430,8 +430,8 @@ namespace Godot
|
|||||||
{
|
{
|
||||||
int pos = instance.RFind(".");
|
int pos = instance.RFind(".");
|
||||||
|
|
||||||
if (pos < 0)
|
if (pos < 0 || pos < Math.Max(instance.RFind("/"), instance.RFind("\\")))
|
||||||
return instance;
|
return string.Empty;
|
||||||
|
|
||||||
return instance.Substring(pos + 1);
|
return instance.Substring(pos + 1);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user