diff options
Diffstat (limited to 'platform')
-rw-r--r-- | platform/android/dir_access_jandroid.cpp | 8 | ||||
-rw-r--r-- | platform/android/export/export_plugin.cpp | 22 | ||||
-rw-r--r-- | platform/android/export/gradle_export_util.cpp | 2 | ||||
-rw-r--r-- | platform/android/os_android.cpp | 14 | ||||
-rw-r--r-- | platform/iphone/export/export_plugin.cpp | 6 | ||||
-rw-r--r-- | platform/javascript/export/export_plugin.cpp | 6 | ||||
-rw-r--r-- | platform/linuxbsd/os_linuxbsd.cpp | 8 | ||||
-rw-r--r-- | platform/osx/export/export_plugin.cpp | 8 | ||||
-rw-r--r-- | platform/uwp/export/export_plugin.cpp | 8 | ||||
-rw-r--r-- | platform/windows/display_server_windows.cpp | 2 | ||||
-rw-r--r-- | platform/windows/export/export_plugin.cpp | 30 | ||||
-rw-r--r-- | platform/windows/os_windows.cpp | 6 |
12 files changed, 60 insertions, 60 deletions
diff --git a/platform/android/dir_access_jandroid.cpp b/platform/android/dir_access_jandroid.cpp index 0eeee8215d..d2726b8652 100644 --- a/platform/android/dir_access_jandroid.cpp +++ b/platform/android/dir_access_jandroid.cpp @@ -102,7 +102,7 @@ String DirAccessJAndroid::get_drive(int p_drive) { Error DirAccessJAndroid::change_dir(String p_dir) { JNIEnv *env = get_jni_env(); - if (p_dir == "" || p_dir == "." || (p_dir == ".." && current_dir == "")) + if (p_dir.is_empty() || p_dir == "." || (p_dir == ".." && current_dir.is_empty())) return OK; String new_dir; @@ -114,7 +114,7 @@ Error DirAccessJAndroid::change_dir(String p_dir) { new_dir = p_dir.substr(1, p_dir.length()); else if (p_dir.begins_with("res://")) new_dir = p_dir.substr(6, p_dir.length()); - else if (current_dir == "") + else if (current_dir.is_empty()) new_dir = p_dir; else new_dir = current_dir.plus_file(p_dir); @@ -141,7 +141,7 @@ String DirAccessJAndroid::get_current_dir(bool p_include_drive) { bool DirAccessJAndroid::file_exists(String p_file) { String sd; - if (current_dir == "") + if (current_dir.is_empty()) sd = p_file; else sd = current_dir.plus_file(p_file); @@ -158,7 +158,7 @@ bool DirAccessJAndroid::dir_exists(String p_dir) { String sd; - if (current_dir == "") + if (current_dir.is_empty()) sd = p_dir; else { if (p_dir.is_relative_path()) 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-")) { diff --git a/platform/android/os_android.cpp b/platform/android/os_android.cpp index 0e5e10bc0a..ffd69a56b9 100644 --- a/platform/android/os_android.cpp +++ b/platform/android/os_android.cpp @@ -198,7 +198,7 @@ String OS_Android::get_resource_dir() const { String OS_Android::get_locale() const { String locale = godot_io_java->get_locale(); - if (locale != "") { + if (!locale.is_empty()) { return locale; } @@ -207,7 +207,7 @@ String OS_Android::get_locale() const { String OS_Android::get_model_name() const { String model = godot_io_java->get_model(); - if (model != "") + if (!model.is_empty()) return model; return OS_Unix::get_model_name(); @@ -218,11 +218,11 @@ String OS_Android::get_data_path() const { } String OS_Android::get_user_data_dir() const { - if (data_dir_cache != String()) + if (!data_dir_cache.is_empty()) return data_dir_cache; String data_dir = godot_io_java->get_user_data_dir(); - if (data_dir != "") { + if (!data_dir.is_empty()) { data_dir_cache = _remove_symlink(data_dir); return data_dir_cache; } @@ -230,11 +230,11 @@ String OS_Android::get_user_data_dir() const { } String OS_Android::get_cache_path() const { - if (cache_dir_cache != String()) + if (!cache_dir_cache.is_empty()) return cache_dir_cache; String cache_dir = godot_io_java->get_cache_dir(); - if (cache_dir != "") { + if (!cache_dir.is_empty()) { cache_dir_cache = _remove_symlink(cache_dir); return cache_dir_cache; } @@ -243,7 +243,7 @@ String OS_Android::get_cache_path() const { String OS_Android::get_unique_id() const { String unique_id = godot_io_java->get_unique_id(); - if (unique_id != "") + if (!unique_id.is_empty()) return unique_id; return OS::get_unique_id(); diff --git a/platform/iphone/export/export_plugin.cpp b/platform/iphone/export/export_plugin.cpp index 0abd255c7c..247b456b26 100644 --- a/platform/iphone/export/export_plugin.cpp +++ b/platform/iphone/export/export_plugin.cpp @@ -1363,10 +1363,10 @@ Error EditorExportPlatformIOS::export_project(const Ref<EditorExportPreset> &p_p src_pkg_name = p_preset->get("custom_template/release"); } - if (src_pkg_name == "") { + if (src_pkg_name.is_empty()) { String err; src_pkg_name = find_export_template("iphone.zip", &err); - if (src_pkg_name == "") { + if (src_pkg_name.is_empty()) { EditorNode::add_io_error(err); return ERR_FILE_NOT_FOUND; } @@ -1767,7 +1767,7 @@ bool EditorExportPlatformIOS::can_export(const Ref<EditorExportPreset> &p_preset } String etc_error = test_etc2_or_pvrtc(); - if (etc_error != String()) { + if (!etc_error.is_empty()) { valid = false; err += etc_error; } diff --git a/platform/javascript/export/export_plugin.cpp b/platform/javascript/export/export_plugin.cpp index 018dd3b664..9733435584 100644 --- a/platform/javascript/export/export_plugin.cpp +++ b/platform/javascript/export/export_plugin.cpp @@ -380,7 +380,7 @@ bool EditorExportPlatformJavaScript::can_export(const Ref<EditorExportPreset> &p if (p_preset->get("vram_texture_compression/for_mobile")) { String etc_error = test_etc2(); - if (etc_error != String()) { + if (!etc_error.is_empty()) { valid = false; err += etc_error; } @@ -415,7 +415,7 @@ Error EditorExportPlatformJavaScript::export_project(const Ref<EditorExportPrese // Find the correct template String template_path = p_debug ? custom_debug : custom_release; template_path = template_path.strip_edges(); - if (template_path == String()) { + if (template_path.is_empty()) { ExportMode mode = (ExportMode)(int)p_preset->get("variant/export_type"); template_path = find_export_template(_get_template_name(mode, p_debug)); } @@ -424,7 +424,7 @@ Error EditorExportPlatformJavaScript::export_project(const Ref<EditorExportPrese return ERR_FILE_BAD_PATH; } - if (template_path != String() && !FileAccess::exists(template_path)) { + if (!template_path.is_empty() && !FileAccess::exists(template_path)) { EditorNode::get_singleton()->show_warning(TTR("Template file not found:") + "\n" + template_path); return ERR_FILE_NOT_FOUND; } diff --git a/platform/linuxbsd/os_linuxbsd.cpp b/platform/linuxbsd/os_linuxbsd.cpp index 69474c6dec..c39b5cb784 100644 --- a/platform/linuxbsd/os_linuxbsd.cpp +++ b/platform/linuxbsd/os_linuxbsd.cpp @@ -419,7 +419,7 @@ Error OS_LinuxBSD::move_to_trash(const String &p_path) { String mnt = get_mountpoint(p_path); // If there is a directory "[Mountpoint]/.Trash-[UID], use it as the trash can. - if (mnt != "") { + if (!mnt.is_empty()) { String path(mnt + "/.Trash-" + itos(getuid())); struct stat s; if (!stat(path.utf8().get_data(), &s)) { @@ -428,7 +428,7 @@ Error OS_LinuxBSD::move_to_trash(const String &p_path) { } // Otherwise, if ${XDG_DATA_HOME} is defined, use "${XDG_DATA_HOME}/Trash" as the trash can. - if (trash_path == "") { + if (trash_path.is_empty()) { char *dhome = getenv("XDG_DATA_HOME"); if (dhome) { trash_path = String(dhome) + "/Trash"; @@ -436,7 +436,7 @@ Error OS_LinuxBSD::move_to_trash(const String &p_path) { } // Otherwise, if ${HOME} is defined, use "${HOME}/.local/share/Trash" as the trash can. - if (trash_path == "") { + if (trash_path.is_empty()) { char *home = getenv("HOME"); if (home) { trash_path = String(home) + "/.local/share/Trash"; @@ -444,7 +444,7 @@ Error OS_LinuxBSD::move_to_trash(const String &p_path) { } // Issue an error if none of the previous locations is appropriate for the trash can. - ERR_FAIL_COND_V_MSG(trash_path == "", FAILED, "Could not determine the trash can location"); + ERR_FAIL_COND_V_MSG(trash_path.is_empty(), FAILED, "Could not determine the trash can location"); // Create needed directories for decided trash can location. { diff --git a/platform/osx/export/export_plugin.cpp b/platform/osx/export/export_plugin.cpp index 36a2e5e205..8126510245 100644 --- a/platform/osx/export/export_plugin.cpp +++ b/platform/osx/export/export_plugin.cpp @@ -481,10 +481,10 @@ Error EditorExportPlatformOSX::export_project(const Ref<EditorExportPreset> &p_p src_pkg_name = p_preset->get("custom_template/release"); } - if (src_pkg_name == "") { + if (src_pkg_name.is_empty()) { String err; src_pkg_name = find_export_template("osx.zip", &err); - if (src_pkg_name == "") { + if (src_pkg_name.is_empty()) { EditorNode::add_io_error(err); return ERR_FILE_NOT_FOUND; } @@ -607,7 +607,7 @@ Error EditorExportPlatformOSX::export_project(const Ref<EditorExportPreset> &p_p iconpath = ProjectSettings::get_singleton()->get("application/config/icon"); } - if (iconpath != "") { + if (!iconpath.is_empty()) { if (iconpath.get_extension() == "icns") { FileAccess *icon = FileAccess::open(iconpath, FileAccess::READ); if (icon) { @@ -695,7 +695,7 @@ Error EditorExportPlatformOSX::export_project(const Ref<EditorExportPreset> &p_p String ent_path = p_preset->get("codesign/entitlements/custom_file"); String hlp_ent_path = EditorPaths::get_singleton()->get_cache_dir().plus_file(pkg_name + "_helper.entitlements"); - if (sign_enabled && (ent_path == "")) { + if (sign_enabled && (ent_path.is_empty())) { ent_path = EditorPaths::get_singleton()->get_cache_dir().plus_file(pkg_name + ".entitlements"); FileAccess *ent_f = FileAccess::open(ent_path, FileAccess::WRITE); diff --git a/platform/uwp/export/export_plugin.cpp b/platform/uwp/export/export_plugin.cpp index 192814efe4..31a6889543 100644 --- a/platform/uwp/export/export_plugin.cpp +++ b/platform/uwp/export/export_plugin.cpp @@ -257,7 +257,7 @@ Error EditorExportPlatformUWP::export_project(const Ref<EditorExportPreset> &p_p Platform arch = (Platform)(int)p_preset->get("architecture/target"); - if (src_appx == "") { + if (src_appx.is_empty()) { String err, infix; switch (arch) { case ARM: { @@ -275,7 +275,7 @@ Error EditorExportPlatformUWP::export_project(const Ref<EditorExportPreset> &p_p } else { src_appx = find_export_template("uwp" + infix + "release.zip", &err); } - if (src_appx == "") { + if (src_appx.is_empty()) { EditorNode::add_io_error(err); return ERR_FILE_NOT_FOUND; } @@ -431,7 +431,7 @@ Error EditorExportPlatformUWP::export_project(const Ref<EditorExportPreset> &p_p #ifdef WINDOWS_ENABLED // Sign with signtool String signtool_path = EditorSettings::get_singleton()->get("export/uwp/signtool"); - if (signtool_path == String()) { + if (signtool_path.is_empty()) { return OK; } @@ -452,7 +452,7 @@ Error EditorExportPlatformUWP::export_project(const Ref<EditorExportPreset> &p_p cert_alg = p_preset->get("signing/algorithm"); } - if (cert_path == String()) { + if (cert_path.is_empty()) { return OK; // Certificate missing, don't try to sign } diff --git a/platform/windows/display_server_windows.cpp b/platform/windows/display_server_windows.cpp index 9fe15366f4..2878981078 100644 --- a/platform/windows/display_server_windows.cpp +++ b/platform/windows/display_server_windows.cpp @@ -1565,7 +1565,7 @@ String DisplayServerWindows::keyboard_get_layout_name(int p_index) const { GetKeyboardLayoutList(layout_count, layouts); String ret = _get_full_layout_name_from_registry(layouts[p_index]); // Try reading full name from Windows registry, fallback to locale name if failed (e.g. on Wine). - if (ret == String()) { + if (ret.is_empty()) { WCHAR buf[LOCALE_NAME_MAX_LENGTH]; memset(buf, 0, LOCALE_NAME_MAX_LENGTH * sizeof(WCHAR)); LCIDToLocaleName(MAKELCID(LOWORD(layouts[p_index]), SORT_DEFAULT), buf, LOCALE_NAME_MAX_LENGTH, 0); diff --git a/platform/windows/export/export_plugin.cpp b/platform/windows/export/export_plugin.cpp index 165e86c066..5a1cdb0962 100644 --- a/platform/windows/export/export_plugin.cpp +++ b/platform/windows/export/export_plugin.cpp @@ -82,7 +82,7 @@ void EditorExportPlatformWindows::get_export_options(List<ExportOption> *r_optio void EditorExportPlatformWindows::_rcedit_add_data(const Ref<EditorExportPreset> &p_preset, const String &p_path) { String rcedit_path = EditorSettings::get_singleton()->get("export/windows/rcedit"); - if (rcedit_path == String()) { + if (rcedit_path.is_empty()) { return; } @@ -95,12 +95,12 @@ void EditorExportPlatformWindows::_rcedit_add_data(const Ref<EditorExportPreset> // On non-Windows we need WINE to run rcedit String wine_path = EditorSettings::get_singleton()->get("export/windows/wine"); - if (wine_path != String() && !FileAccess::exists(wine_path)) { + if (!wine_path.is_empty() && !FileAccess::exists(wine_path)) { ERR_PRINT("Could not find wine executable at " + wine_path + ", no icon or app information data will be included."); return; } - if (wine_path == String()) { + if (wine_path.is_empty()) { wine_path = "wine"; // try to run wine from PATH } #endif @@ -117,39 +117,39 @@ void EditorExportPlatformWindows::_rcedit_add_data(const Ref<EditorExportPreset> List<String> args; args.push_back(p_path); - if (icon_path != String()) { + if (!icon_path.is_empty()) { args.push_back("--set-icon"); args.push_back(icon_path); } - if (file_verion != String()) { + if (!file_verion.is_empty()) { args.push_back("--set-file-version"); args.push_back(file_verion); } - if (product_version != String()) { + if (!product_version.is_empty()) { args.push_back("--set-product-version"); args.push_back(product_version); } - if (company_name != String()) { + if (!company_name.is_empty()) { args.push_back("--set-version-string"); args.push_back("CompanyName"); args.push_back(company_name); } - if (product_name != String()) { + if (!product_name.is_empty()) { args.push_back("--set-version-string"); args.push_back("ProductName"); args.push_back(product_name); } - if (file_description != String()) { + if (!file_description.is_empty()) { args.push_back("--set-version-string"); args.push_back("FileDescription"); args.push_back(file_description); } - if (copyright != String()) { + if (!copyright.is_empty()) { args.push_back("--set-version-string"); args.push_back("LegalCopyright"); args.push_back(copyright); } - if (trademarks != String()) { + if (!trademarks.is_empty()) { args.push_back("--set-version-string"); args.push_back("LegalTrademarks"); args.push_back(trademarks); @@ -169,20 +169,20 @@ Error EditorExportPlatformWindows::_code_sign(const Ref<EditorExportPreset> &p_p #ifdef WINDOWS_ENABLED String signtool_path = EditorSettings::get_singleton()->get("export/windows/signtool"); - if (signtool_path != String() && !FileAccess::exists(signtool_path)) { + if (!signtool_path.is_empty() && !FileAccess::exists(signtool_path)) { ERR_PRINT("Could not find signtool executable at " + signtool_path + ", aborting."); return ERR_FILE_NOT_FOUND; } - if (signtool_path == String()) { + if (signtool_path.is_empty()) { signtool_path = "signtool"; // try to run signtool from PATH } #else String signtool_path = EditorSettings::get_singleton()->get("export/windows/osslsigncode"); - if (signtool_path != String() && !FileAccess::exists(signtool_path)) { + if (!signtool_path.is_empty() && !FileAccess::exists(signtool_path)) { ERR_PRINT("Could not find osslsigncode executable at " + signtool_path + ", aborting."); return ERR_FILE_NOT_FOUND; } - if (signtool_path == String()) { + if (signtool_path.is_empty()) { signtool_path = "osslsigncode"; // try to run signtool from PATH } #endif diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp index 6a0a4790fc..d2cf9a62ee 100644 --- a/platform/windows/os_windows.cpp +++ b/platform/windows/os_windows.cpp @@ -606,7 +606,7 @@ String OS_Windows::get_locale() const { wl++; } - if (neutral != "") + if (!neutral.is_empty()) return String(neutral).replace("-", "_"); return "en"; @@ -757,11 +757,11 @@ String OS_Windows::get_system_dir(SystemDir p_dir, bool p_shared_storage) const String OS_Windows::get_user_data_dir() const { String appname = get_safe_dir_name(ProjectSettings::get_singleton()->get("application/config/name")); - if (appname != "") { + if (!appname.is_empty()) { bool use_custom_dir = ProjectSettings::get_singleton()->get("application/config/use_custom_user_dir"); if (use_custom_dir) { String custom_dir = get_safe_dir_name(ProjectSettings::get_singleton()->get("application/config/custom_user_dir_name"), true); - if (custom_dir == "") { + if (custom_dir.is_empty()) { custom_dir = appname; } return get_data_path().plus_file(custom_dir).replace("\\", "/"); |