浏览代码

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().
Michael Wörner 2 月之前
父节点
当前提交
77208a62a4
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. 2 2
      modules/mono/glue/GodotSharp/GodotSharp/Core/StringExtensions.cs

+ 2 - 2
modules/mono/glue/GodotSharp/GodotSharp/Core/StringExtensions.cs

@@ -430,8 +430,8 @@ namespace Godot
         {
             int pos = instance.RFind(".");
 
-            if (pos < 0)
-                return instance;
+            if (pos < 0 || pos < Math.Max(instance.RFind("/"), instance.RFind("\\")))
+                return string.Empty;
 
             return instance.Substring(pos + 1);
         }