Expose String.SimplifyPath in C#

This commit is contained in:
Raul Santos 2021-08-25 03:24:57 +02:00
parent c89a5fb8be
commit 126b1ea149
2 changed files with 17 additions and 0 deletions

View File

@ -1102,6 +1102,17 @@ namespace Godot
return 2.0f * inter / sum;
}
/// <summary>
/// Returns a simplified canonical path.
/// </summary>
public static string SimplifyPath(this string instance)
{
return godot_icall_String_simplify_path(instance);
}
[MethodImpl(MethodImplOptions.InternalCall)]
internal extern static string godot_icall_String_simplify_path(string str);
/// <summary>
/// Split the string by a divisor string, return an array of the substrings.
/// Example "One,Two,Three" will return ["One","Two","Three"] if split by ",".

View File

@ -67,6 +67,11 @@ MonoString *godot_icall_String_sha256_text(MonoString *p_str) {
return GDMonoMarshal::mono_string_from_godot(ret);
}
MonoString *godot_icall_String_simplify_path(MonoString *p_str) {
String ret = GDMonoMarshal::mono_string_to_godot(p_str).simplify_path();
return GDMonoMarshal::mono_string_from_godot(ret);
}
void godot_register_string_icalls() {
GDMonoUtils::add_internal_call("Godot.StringExtensions::godot_icall_String_md5_buffer", godot_icall_String_md5_buffer);
GDMonoUtils::add_internal_call("Godot.StringExtensions::godot_icall_String_md5_text", godot_icall_String_md5_text);
@ -74,6 +79,7 @@ void godot_register_string_icalls() {
GDMonoUtils::add_internal_call("Godot.StringExtensions::godot_icall_String_rfindn", godot_icall_String_rfindn);
GDMonoUtils::add_internal_call("Godot.StringExtensions::godot_icall_String_sha256_buffer", godot_icall_String_sha256_buffer);
GDMonoUtils::add_internal_call("Godot.StringExtensions::godot_icall_String_sha256_text", godot_icall_String_sha256_text);
GDMonoUtils::add_internal_call("Godot.StringExtensions::godot_icall_String_simplify_path", godot_icall_String_simplify_path);
}
#endif // MONO_GLUE_ENABLED