You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-14 13:41:12 +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:
@@ -178,7 +178,7 @@ void ProjectExportDialog::_update_export_all() {
|
||||
Ref<EditorExportPreset> preset = EditorExport::get_singleton()->get_export_preset(i);
|
||||
bool needs_templates;
|
||||
String error;
|
||||
if (preset->get_export_path() == "" || !preset->get_platform()->can_export(preset, error, needs_templates)) {
|
||||
if (preset->get_export_path().is_empty() || !preset->get_platform()->can_export(preset, error, needs_templates)) {
|
||||
can_export = false;
|
||||
break;
|
||||
}
|
||||
@@ -244,7 +244,7 @@ void ProjectExportDialog::_edit_preset(int p_index) {
|
||||
bool needs_templates;
|
||||
String error;
|
||||
if (!current->get_platform()->can_export(current, error, needs_templates)) {
|
||||
if (error != String()) {
|
||||
if (!error.is_empty()) {
|
||||
Vector<String> items = error.split("\n", false);
|
||||
error = "";
|
||||
for (int i = 0; i < items.size(); i++) {
|
||||
@@ -336,7 +336,7 @@ void ProjectExportDialog::_update_feature_list() {
|
||||
Vector<String> custom_list = custom.split(",");
|
||||
for (int i = 0; i < custom_list.size(); i++) {
|
||||
String f = custom_list[i].strip_edges();
|
||||
if (f != String()) {
|
||||
if (!f.is_empty()) {
|
||||
features.push_back(f);
|
||||
}
|
||||
}
|
||||
@@ -871,7 +871,7 @@ void ProjectExportDialog::_open_export_template_manager() {
|
||||
|
||||
void ProjectExportDialog::_validate_export_path(const String &p_path) {
|
||||
// Disable export via OK button or Enter key if LineEdit has an empty filename
|
||||
bool invalid_path = (p_path.get_file().get_basename() == "");
|
||||
bool invalid_path = (p_path.get_file().get_basename().is_empty());
|
||||
|
||||
// Check if state change before needlessly messing with signals
|
||||
if (invalid_path && export_project->get_ok_button()->is_disabled()) {
|
||||
@@ -904,7 +904,7 @@ void ProjectExportDialog::_export_project() {
|
||||
export_project->add_filter("*." + extension_list[i] + " ; " + platform->get_name() + " Export");
|
||||
}
|
||||
|
||||
if (current->get_export_path() != "") {
|
||||
if (!current->get_export_path().is_empty()) {
|
||||
export_project->set_current_path(current->get_export_path());
|
||||
} else {
|
||||
if (extension_list.size() >= 1) {
|
||||
@@ -1292,10 +1292,10 @@ ProjectExportDialog::ProjectExportDialog() {
|
||||
|
||||
default_filename = EditorSettings::get_singleton()->get_project_metadata("export_options", "default_filename", "");
|
||||
// If no default set, use project name
|
||||
if (default_filename == "") {
|
||||
if (default_filename.is_empty()) {
|
||||
// If no project name defined, use a sane default
|
||||
default_filename = ProjectSettings::get_singleton()->get("application/config/name");
|
||||
if (default_filename == "") {
|
||||
if (default_filename.is_empty()) {
|
||||
default_filename = "UnnamedProject";
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user