diff options
author | Nathan Franke <natfra@pm.me> | 2021-12-09 03:42:46 -0600 |
---|---|---|
committer | Nathan Franke <natfra@pm.me> | 2021-12-09 04:48:38 -0600 |
commit | 49403cbfa0399bb4284ea5c36cc90216a0bda6ff (patch) | |
tree | caa6c7249d35d83b288a180a4f5d7e4fd959704f /platform/android/export | |
parent | 31ded7e126b9d71ed8dddab9ffc1ce813f1a8ec2 (diff) |
Replace String comparisons with "", String() to is_empty()
Also:
- Adds two stress tests to test_string.h
- Changes to .empty() on std::strings
Diffstat (limited to 'platform/android/export')
-rw-r--r-- | platform/android/export/export_plugin.cpp | 22 | ||||
-rw-r--r-- | platform/android/export/gradle_export_util.cpp | 2 |
2 files changed, 12 insertions, 12 deletions
diff --git a/platform/android/export/export_plugin.cpp b/platform/android/export/export_plugin.cpp index c5d3cbd966..0826f5362e 100644 --- a/platform/android/export/export_plugin.cpp +++ b/platform/android/export/export_plugin.cpp @@ -303,7 +303,7 @@ void EditorExportPlatformAndroid::_check_for_changes_poll_thread(void *ud) { } } - if (d.description == "") { + if (d.description.is_empty()) { //in the oven, request! args.clear(); args.push_back("-s"); @@ -352,7 +352,7 @@ void EditorExportPlatformAndroid::_check_for_changes_poll_thread(void *ud) { } d.name = vendor + " " + device; - if (device == String()) { + if (device.is_empty()) { continue; } } @@ -390,13 +390,13 @@ void EditorExportPlatformAndroid::_check_for_changes_poll_thread(void *ud) { String EditorExportPlatformAndroid::get_project_name(const String &p_name) const { String aname; - if (p_name != "") { + if (!p_name.is_empty()) { aname = p_name; } else { aname = ProjectSettings::get_singleton()->get("application/config/name"); } - if (aname == "") { + if (aname.is_empty()) { aname = VERSION_NAME; } @@ -420,7 +420,7 @@ String EditorExportPlatformAndroid::get_package_name(const String &p_package) co first = false; } } - if (name == "") { + if (name.is_empty()) { name = "noname"; } @@ -577,7 +577,7 @@ Vector<String> EditorExportPlatformAndroid::list_gdap_files(const String &p_path da->list_dir_begin(); while (true) { String file = da->get_next(); - if (file == "") { + if (file.is_empty()) { break; } @@ -2080,7 +2080,7 @@ bool EditorExportPlatformAndroid::can_export(const Ref<EditorExportPreset> &p_pr } String sdk_path = EditorSettings::get_singleton()->get("export/android/android_sdk_path"); - if (sdk_path == "") { + if (sdk_path.is_empty()) { err += TTR("A valid Android SDK path is required in Editor Settings.") + "\n"; valid = false; } else { @@ -2127,7 +2127,7 @@ bool EditorExportPlatformAndroid::can_export(const Ref<EditorExportPreset> &p_pr if (apk_expansion) { String apk_expansion_pkey = p_preset->get("apk_expansion/public_key"); - if (apk_expansion_pkey == "") { + if (apk_expansion_pkey.is_empty()) { valid = false; err += TTR("Invalid public key for APK expansion.") + "\n"; @@ -2143,7 +2143,7 @@ bool EditorExportPlatformAndroid::can_export(const Ref<EditorExportPreset> &p_pr } String etc_error = test_etc2(); - if (etc_error != String()) { + if (!etc_error.is_empty()) { valid = false; err += etc_error; } @@ -2680,13 +2680,13 @@ Error EditorExportPlatformAndroid::export_project_helper(const Ref<EditorExportP src_apk = p_preset->get("custom_template/release"); } src_apk = src_apk.strip_edges(); - if (src_apk == "") { + if (src_apk.is_empty()) { if (p_debug) { src_apk = find_export_template("android_debug.apk"); } else { src_apk = find_export_template("android_release.apk"); } - if (src_apk == "") { + if (src_apk.is_empty()) { EditorNode::add_io_error(vformat(TTR("Package not found: %s"), src_apk)); return ERR_FILE_NOT_FOUND; } diff --git a/platform/android/export/gradle_export_util.cpp b/platform/android/export/gradle_export_util.cpp index 658c0ecd0a..7f514332f7 100644 --- a/platform/android/export/gradle_export_util.cpp +++ b/platform/android/export/gradle_export_util.cpp @@ -161,7 +161,7 @@ Error _create_project_name_strings_files(const Ref<EditorExportPreset> &p_preset da->list_dir_begin(); while (true) { String file = da->get_next(); - if (file == "") { + if (file.is_empty()) { break; } if (!file.begins_with("values-")) { |