mirror of
https://github.com/godotengine/godot.git
synced 2025-12-07 22:00:10 +00:00
Add String::replace_char(s) methods for performance and convenience
This commit is contained in:
parent
c374ce211c
commit
889410dcda
67 changed files with 297 additions and 137 deletions
|
|
@ -54,10 +54,10 @@ static String fix_path(const String &p_path) {
|
|||
size_t str_len = GetCurrentDirectoryW(0, nullptr);
|
||||
current_dir_name.resize(str_len + 1);
|
||||
GetCurrentDirectoryW(current_dir_name.size(), (LPWSTR)current_dir_name.ptrw());
|
||||
path = String::utf16((const char16_t *)current_dir_name.get_data()).trim_prefix(R"(\\?\)").replace("\\", "/").path_join(path);
|
||||
path = String::utf16((const char16_t *)current_dir_name.get_data()).trim_prefix(R"(\\?\)").replace_char('\\', '/').path_join(path);
|
||||
}
|
||||
path = path.simplify_path();
|
||||
path = path.replace("/", "\\");
|
||||
path = path.replace_char('/', '\\');
|
||||
if (path.size() >= MAX_PATH && !path.is_network_share_path() && !path.begins_with(R"(\\?\)")) {
|
||||
path = R"(\\?\)" + path;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue