瀏覽代碼

Merge pull request #52042 from Rubonnek/expose-simplify-path-3

[3.x] Expose `String.simplify_path`
Max Hilbrunner 4 年之前
父節點
當前提交
0b0002e7b4
共有 2 個文件被更改,包括 8 次插入0 次删除
  1. 2 0
      core/variant_call.cpp
  2. 6 0
      doc/classes/String.xml

+ 2 - 0
core/variant_call.cpp

@@ -291,6 +291,7 @@ struct _VariantCall {
 	VCALL_LOCALMEM0R(String, empty);
 	VCALL_LOCALMEM1R(String, humanize_size);
 	VCALL_LOCALMEM0R(String, is_abs_path);
+	VCALL_LOCALMEM0R(String, simplify_path);
 	VCALL_LOCALMEM0R(String, is_rel_path);
 	VCALL_LOCALMEM0R(String, get_base_dir);
 	VCALL_LOCALMEM0R(String, get_file);
@@ -1686,6 +1687,7 @@ void register_variant_methods() {
 	ADDFUNC0R(STRING, BOOL, String, empty, varray());
 	ADDFUNC1R(STRING, STRING, String, humanize_size, INT, "size", varray());
 	ADDFUNC0R(STRING, BOOL, String, is_abs_path, varray());
+	ADDFUNC0R(STRING, BOOL, String, simplify_path, varray());
 	ADDFUNC0R(STRING, BOOL, String, is_rel_path, varray());
 	ADDFUNC0R(STRING, STRING, String, get_base_dir, varray());
 	ADDFUNC0R(STRING, STRING, String, get_file, varray());

+ 6 - 0
doc/classes/String.xml

@@ -666,6 +666,12 @@
 				Returns the similarity index of the text compared to this string. 1 means totally similar and 0 means totally dissimilar.
 			</description>
 		</method>
+		<method name="simplify_path">
+			<return type="bool" />
+			<description>
+				Returns a simplified canonical path.
+			</description>
+		</method>
 		<method name="split">
 			<return type="PoolStringArray" />
 			<argument index="0" name="delimiter" type="String" />