diff options
author | Rémi Verschelde <remi@verschelde.fr> | 2021-12-10 08:56:31 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-10 08:56:31 +0100 |
commit | bdf8340e5993ec3f86e4bf1d5ede48df7d023a12 (patch) | |
tree | 1e366583662397e366d4f84bb334660db37cb5bd /editor/script_create_dialog.cpp | |
parent | 5ad9d8bad69309d71ea55f3d799af7e3711dc262 (diff) | |
parent | 49403cbfa0399bb4284ea5c36cc90216a0bda6ff (diff) |
Merge pull request #43181 from nathanfranke/string-empty
Replace String comparisons with "", String() to is_empty()
Diffstat (limited to 'editor/script_create_dialog.cpp')
-rw-r--r-- | editor/script_create_dialog.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/editor/script_create_dialog.cpp b/editor/script_create_dialog.cpp index afb1d5107c..0e96a1d247 100644 --- a/editor/script_create_dialog.cpp +++ b/editor/script_create_dialog.cpp @@ -101,7 +101,7 @@ void ScriptCreateDialog::config(const String &p_base_name, const String &p_base_ parent_name->set_text(p_base_name); parent_name->deselect(); - if (p_base_path != "") { + if (!p_base_path.is_empty()) { initial_bp = p_base_path.get_basename(); file_path->set_text(initial_bp + "." + ScriptServer::get_language(language_menu->get_selected())->get_extension()); current_language = language_menu->get_selected(); @@ -163,10 +163,10 @@ bool ScriptCreateDialog::_validate_class(const String &p_string) { String ScriptCreateDialog::_validate_path(const String &p_path, bool p_file_must_exist) { String p = p_path.strip_edges(); - if (p == "") { + if (p.is_empty()) { return TTR("Path is empty."); } - if (p.get_file().get_basename() == "") { + if (p.get_file().get_basename().is_empty()) { return TTR("Filename is empty."); } @@ -227,7 +227,7 @@ String ScriptCreateDialog::_validate_path(const String &p_path, bool p_file_must /* Let ScriptLanguage do custom validation */ String path_error = ScriptServer::get_language(language_menu->get_selected())->validate_path(p); - if (path_error != "") { + if (!path_error.is_empty()) { return path_error; } @@ -295,7 +295,7 @@ void ScriptCreateDialog::_create_new() { String cname_param = _get_class_name(); Ref<Script> scr; - if (script_template != "") { + if (!script_template.is_empty()) { scr = ResourceLoader::load(script_template); if (scr.is_null()) { alert->set_text(vformat(TTR("Error loading template '%s'"), script_template)); @@ -358,7 +358,7 @@ void ScriptCreateDialog::_lang_changed(int l) { String selected_ext = "." + language->get_extension(); String path = file_path->get_text(); String extension = ""; - if (path != "") { + if (!path.is_empty()) { if (path.find(".") != -1) { extension = path.get_extension(); } @@ -582,7 +582,7 @@ void ScriptCreateDialog::_path_changed(const String &p_path) { is_new_script_created = true; String path_error = _validate_path(p_path, false); - if (path_error != "") { + if (!path_error.is_empty()) { _msg_path_valid(false, path_error); _update_dialog(); return; |