You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-16 14:00:40 +00:00
Clean up some uses of String::substr
Cases where the end position is either equvalent to the default or past the end of the string.
This commit is contained in:
@@ -172,7 +172,7 @@ void EditorFileDialog::_native_dialog_cb(bool p_ok, const Vector<String> &p_file
|
||||
|
||||
if (!valid && filter_slice_count > 0) {
|
||||
String str = (flt.get_slice(",", 0).strip_edges());
|
||||
f += str.substr(1, str.length() - 1);
|
||||
f += str.substr(1);
|
||||
file->set_text(f.get_file());
|
||||
valid = true;
|
||||
}
|
||||
@@ -650,7 +650,7 @@ void EditorFileDialog::_action_pressed() {
|
||||
|
||||
if (!valid && filter_slice_count > 0) {
|
||||
String str = (flt.get_slice(",", 0).strip_edges());
|
||||
f += str.substr(1, str.length() - 1);
|
||||
f += str.substr(1);
|
||||
_request_single_thumbnail(get_current_dir().path_join(f.get_file()));
|
||||
file->set_text(f.get_file());
|
||||
valid = true;
|
||||
@@ -1436,7 +1436,7 @@ void EditorFileDialog::set_current_path(const String &p_path) {
|
||||
set_current_file(p_path);
|
||||
} else {
|
||||
String path_dir = p_path.substr(0, pos);
|
||||
String path_file = p_path.substr(pos + 1, p_path.length());
|
||||
String path_file = p_path.substr(pos + 1);
|
||||
set_current_dir(path_dir);
|
||||
set_current_file(path_file);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user