You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-12 13:20:55 +00:00
Replace String comparisons with "", String() to is_empty()
Also: - Adds two stress tests to test_string.h - Changes to .empty() on std::strings
This commit is contained in:
@@ -64,7 +64,7 @@ bool FileSystemDock::_create_tree(TreeItem *p_parent, EditorFileSystemDirectory
|
||||
// Create a tree item for the subdirectory.
|
||||
TreeItem *subdirectory_item = tree->create_item(p_parent);
|
||||
String dname = p_dir->get_name();
|
||||
if (dname == "") {
|
||||
if (dname.is_empty()) {
|
||||
dname = "res://";
|
||||
}
|
||||
|
||||
@@ -923,7 +923,7 @@ void FileSystemDock::_update_file_list(bool p_keep_selection) {
|
||||
files->select(item_index, false);
|
||||
}
|
||||
|
||||
if (!p_keep_selection && file != "" && fname == file) {
|
||||
if (!p_keep_selection && !file.is_empty() && fname == file) {
|
||||
files->select(item_index, true);
|
||||
files->ensure_current_is_visible();
|
||||
}
|
||||
@@ -1670,7 +1670,7 @@ Vector<String> FileSystemDock::_remove_self_included_paths(Vector<String> select
|
||||
selected_strings.sort_custom<NaturalNoCaseComparator>();
|
||||
String last_path = "";
|
||||
for (int i = 0; i < selected_strings.size(); i++) {
|
||||
if (last_path != "" && selected_strings[i].begins_with(last_path)) {
|
||||
if (!last_path.is_empty() && selected_strings[i].begins_with(last_path)) {
|
||||
selected_strings.remove_at(i);
|
||||
i--;
|
||||
}
|
||||
@@ -2016,7 +2016,7 @@ void FileSystemDock::_search_changed(const String &p_text, const Control *p_from
|
||||
tree_search_box->set_text(searched_string);
|
||||
}
|
||||
|
||||
bool unfold_path = (p_text == String() && path != String());
|
||||
bool unfold_path = (p_text.is_empty() && !path.is_empty());
|
||||
switch (display_mode) {
|
||||
case DISPLAY_MODE_TREE_ONLY: {
|
||||
_update_tree(searched_string.length() == 0 ? uncollapsed_paths_before_search : Vector<String>(), false, false, unfold_path);
|
||||
@@ -2665,7 +2665,7 @@ void FileSystemDock::_get_imported_files(const String &p_path, Vector<String> &f
|
||||
DirAccess *da = DirAccess::open(p_path);
|
||||
da->list_dir_begin();
|
||||
String n = da->get_next();
|
||||
while (n != String()) {
|
||||
while (!n.is_empty()) {
|
||||
if (n != "." && n != ".." && !n.ends_with(".import")) {
|
||||
String npath = p_path + n + (da->current_is_dir() ? "/" : "");
|
||||
_get_imported_files(npath, files);
|
||||
@@ -2720,7 +2720,7 @@ void FileSystemDock::_update_import_dock() {
|
||||
if (cf->has_section_key("remap", "type")) {
|
||||
type = cf->get_value("remap", "type");
|
||||
}
|
||||
if (import_type == "") {
|
||||
if (import_type.is_empty()) {
|
||||
import_type = type;
|
||||
} else if (import_type != type) {
|
||||
// All should be the same type.
|
||||
|
||||
Reference in New Issue
Block a user