diff --git a/editor/export/codesign.cpp b/editor/export/codesign.cpp index cc53068d481..f02895fadf1 100644 --- a/editor/export/codesign.cpp +++ b/editor/export/codesign.cpp @@ -214,7 +214,7 @@ bool CodeSignCodeResources::add_nested_file(const String &p_root, const String & Vector files_to_add; if (LipO::is_lipo(p_exepath)) { - String tmp_path_name = EditorPaths::get_singleton()->get_cache_dir().path_join("_lipo"); + String tmp_path_name = EditorPaths::get_singleton()->get_temp_dir().path_join("_lipo"); Error err = da->make_dir_recursive(tmp_path_name); ERR_FAIL_COND_V_MSG(err != OK, false, vformat("CodeSign/CodeResources: Failed to create \"%s\" subfolder.", tmp_path_name)); LipO lip; @@ -1248,7 +1248,7 @@ Error CodeSign::_codesign_file(bool p_use_hardened_runtime, bool p_force, const Vector files_to_sign; if (LipO::is_lipo(main_exe)) { print_verbose(vformat("CodeSign: Executable is fat, extracting...")); - String tmp_path_name = EditorPaths::get_singleton()->get_cache_dir().path_join("_lipo"); + String tmp_path_name = EditorPaths::get_singleton()->get_temp_dir().path_join("_lipo"); Error err = da->make_dir_recursive(tmp_path_name); if (err != OK) { r_error_msg = vformat(TTR("Failed to create \"%s\" subfolder."), tmp_path_name); diff --git a/editor/export/editor_export_platform.cpp b/editor/export/editor_export_platform.cpp index 72fa20f6716..cb496fc9f09 100644 --- a/editor/export/editor_export_platform.cpp +++ b/editor/export/editor_export_platform.cpp @@ -1528,7 +1528,7 @@ Error EditorExportPlatform::export_project_files(const Ref & } String config_file = "project.binary"; - String engine_cfb = EditorPaths::get_singleton()->get_cache_dir().path_join("tmp" + config_file); + String engine_cfb = EditorPaths::get_singleton()->get_temp_dir().path_join("tmp" + config_file); ProjectSettings::get_singleton()->save_custom(engine_cfb, custom_map, custom_list); Vector data = FileAccess::get_file_as_bytes(engine_cfb); DirAccess::remove_file_or_error(engine_cfb); @@ -1832,9 +1832,9 @@ Error EditorExportPlatform::save_pack(const Ref &p_preset, b // Create the temporary export directory if it doesn't exist. Ref da = DirAccess::create(DirAccess::ACCESS_FILESYSTEM); - da->make_dir_recursive(EditorPaths::get_singleton()->get_cache_dir()); + da->make_dir_recursive(EditorPaths::get_singleton()->get_temp_dir()); - String tmppath = EditorPaths::get_singleton()->get_cache_dir().path_join("packtmp"); + String tmppath = EditorPaths::get_singleton()->get_temp_dir().path_join("packtmp"); Ref ftmp = FileAccess::open(tmppath, FileAccess::WRITE); if (ftmp.is_null()) { add_message(EXPORT_MESSAGE_ERROR, TTR("Save PCK"), vformat(TTR("Cannot create file \"%s\"."), tmppath)); @@ -2094,7 +2094,7 @@ Error EditorExportPlatform::save_zip(const Ref &p_preset, bo p_save_func = _save_zip_file; } - String tmppath = EditorPaths::get_singleton()->get_cache_dir().path_join("packtmp"); + String tmppath = EditorPaths::get_singleton()->get_temp_dir().path_join("packtmp"); Ref io_fa; zlib_filefunc_def io = zipio_create_io(&io_fa); diff --git a/platform/android/export/export_plugin.cpp b/platform/android/export/export_plugin.cpp index 293044a8fa0..cc0f75802b5 100644 --- a/platform/android/export/export_plugin.cpp +++ b/platform/android/export/export_plugin.cpp @@ -2085,7 +2085,7 @@ Error EditorExportPlatformAndroid::run(const Ref &p_preset, p_debug_flags.set_flag(DEBUG_FLAG_REMOTE_DEBUG_LOCALHOST); } - String tmp_export_path = EditorPaths::get_singleton()->get_cache_dir().path_join("tmpexport." + uitos(OS::get_singleton()->get_unix_time()) + ".apk"); + String tmp_export_path = EditorPaths::get_singleton()->get_temp_dir().path_join("tmpexport." + uitos(OS::get_singleton()->get_unix_time()) + ".apk"); #define CLEANUP_AND_RETURN(m_err) \ { \ @@ -3445,7 +3445,7 @@ Error EditorExportPlatformAndroid::export_project_helper(const Ref io2_fa; zlib_filefunc_def io2 = zipio_create_io(&io2_fa); - String tmp_unaligned_path = EditorPaths::get_singleton()->get_cache_dir().path_join("tmpexport-unaligned." + uitos(OS::get_singleton()->get_unix_time()) + ".apk"); + String tmp_unaligned_path = EditorPaths::get_singleton()->get_temp_dir().path_join("tmpexport-unaligned." + uitos(OS::get_singleton()->get_unix_time()) + ".apk"); #define CLEANUP_AND_RETURN(m_err) \ { \ diff --git a/platform/ios/export/export_plugin.cpp b/platform/ios/export/export_plugin.cpp index 742127a10e1..667c883e386 100644 --- a/platform/ios/export/export_plugin.cpp +++ b/platform/ios/export/export_plugin.cpp @@ -2433,7 +2433,7 @@ Error EditorExportPlatformIOS::_export_project_helper(const Refget("application/generate_simulator_library_if_missing").operator bool()) { String sim_lib_path = dest_dir + String(binary_name + ".xcframework").path_join("ios-arm64_x86_64-simulator").path_join("libgodot.a"); String dev_lib_path = dest_dir + String(binary_name + ".xcframework").path_join("ios-arm64").path_join("libgodot.a"); - String tmp_lib_path = EditorPaths::get_singleton()->get_cache_dir().path_join(binary_name + "_lipo_"); + String tmp_lib_path = EditorPaths::get_singleton()->get_temp_dir().path_join(binary_name + "_lipo_"); uint32_t cputype = 0; uint32_t cpusubtype = 0; if (!_archive_has_arm64(sim_lib_path, &cputype, &cpusubtype) && _archive_has_arm64(dev_lib_path) && FileAccess::exists(dev_lib_path)) { @@ -3111,19 +3111,19 @@ Error EditorExportPlatformIOS::run(const Ref &p_preset, int String id = "tmpexport." + uitos(OS::get_singleton()->get_unix_time()); Ref filesystem_da = DirAccess::create(DirAccess::ACCESS_FILESYSTEM); - ERR_FAIL_COND_V_MSG(filesystem_da.is_null(), ERR_CANT_CREATE, "Cannot create DirAccess for path '" + EditorPaths::get_singleton()->get_cache_dir() + "'."); - filesystem_da->make_dir_recursive(EditorPaths::get_singleton()->get_cache_dir().path_join(id)); - String tmp_export_path = EditorPaths::get_singleton()->get_cache_dir().path_join(id).path_join("export.ipa"); + ERR_FAIL_COND_V_MSG(filesystem_da.is_null(), ERR_CANT_CREATE, "Cannot create DirAccess for path '" + EditorPaths::get_singleton()->get_temp_dir() + "'."); + filesystem_da->make_dir_recursive(EditorPaths::get_singleton()->get_temp_dir().path_join(id)); + String tmp_export_path = EditorPaths::get_singleton()->get_temp_dir().path_join(id).path_join("export.ipa"); -#define CLEANUP_AND_RETURN(m_err) \ - { \ - if (filesystem_da->change_dir(EditorPaths::get_singleton()->get_cache_dir().path_join(id)) == OK) { \ - filesystem_da->erase_contents_recursive(); \ - filesystem_da->change_dir(".."); \ - filesystem_da->remove(id); \ - } \ - return m_err; \ - } \ +#define CLEANUP_AND_RETURN(m_err) \ + { \ + if (filesystem_da->change_dir(EditorPaths::get_singleton()->get_temp_dir().path_join(id)) == OK) { \ + filesystem_da->erase_contents_recursive(); \ + filesystem_da->change_dir(".."); \ + filesystem_da->remove(id); \ + } \ + return m_err; \ + } \ ((void)0) Device dev = devices[p_device]; @@ -3193,7 +3193,7 @@ Error EditorExportPlatformIOS::run(const Ref &p_preset, int args.push_back("simctl"); args.push_back("install"); args.push_back(dev.id); - args.push_back(EditorPaths::get_singleton()->get_cache_dir().path_join(id).path_join("export.xcarchive/Products/Applications/export.app")); + args.push_back(EditorPaths::get_singleton()->get_temp_dir().path_join(id).path_join("export.xcarchive/Products/Applications/export.app")); String log; int ec; @@ -3246,7 +3246,7 @@ Error EditorExportPlatformIOS::run(const Ref &p_preset, int args.push_back(dev.id); args.push_back("--justlaunch"); args.push_back("--bundle"); - args.push_back(EditorPaths::get_singleton()->get_cache_dir().path_join(id).path_join("export.xcarchive/Products/Applications/export.app")); + args.push_back(EditorPaths::get_singleton()->get_temp_dir().path_join(id).path_join("export.xcarchive/Products/Applications/export.app")); String app_args; for (const String &E : cmd_args_list) { app_args += E + " "; @@ -3285,7 +3285,7 @@ Error EditorExportPlatformIOS::run(const Ref &p_preset, int args.push_back("app"); args.push_back("-d"); args.push_back(dev.id); - args.push_back(EditorPaths::get_singleton()->get_cache_dir().path_join(id).path_join("export.xcarchive/Products/Applications/export.app")); + args.push_back(EditorPaths::get_singleton()->get_temp_dir().path_join(id).path_join("export.xcarchive/Products/Applications/export.app")); String log; int ec; diff --git a/platform/linuxbsd/export/export_plugin.cpp b/platform/linuxbsd/export/export_plugin.cpp index 7cd77dd5937..9362aee5e4c 100644 --- a/platform/linuxbsd/export/export_plugin.cpp +++ b/platform/linuxbsd/export/export_plugin.cpp @@ -88,7 +88,7 @@ Error EditorExportPlatformLinuxBSD::export_project(const Ref // Setup temp folder. String path = p_path; - String tmp_dir_path = EditorPaths::get_singleton()->get_cache_dir().path_join(pkg_name); + String tmp_dir_path = EditorPaths::get_singleton()->get_temp_dir().path_join(pkg_name); Ref tmp_app_dir = DirAccess::create_for_path(tmp_dir_path); if (export_as_zip) { @@ -468,7 +468,7 @@ Error EditorExportPlatformLinuxBSD::run(const Ref &p_preset, EditorProgress ep("run", TTR("Running..."), 5); - const String dest = EditorPaths::get_singleton()->get_cache_dir().path_join("linuxbsd"); + const String dest = EditorPaths::get_singleton()->get_temp_dir().path_join("linuxbsd"); Ref da = DirAccess::create(DirAccess::ACCESS_FILESYSTEM); if (!da->dir_exists(dest)) { Error err = da->make_dir_recursive(dest); diff --git a/platform/macos/export/export_plugin.cpp b/platform/macos/export/export_plugin.cpp index b9f9d8d613a..d795adbe33b 100644 --- a/platform/macos/export/export_plugin.cpp +++ b/platform/macos/export/export_plugin.cpp @@ -1592,7 +1592,7 @@ Error EditorExportPlatformMacOS::export_project(const Ref &p tmp_app_path_name = p_path; scr_path = p_path.get_basename() + ".command"; } else { - tmp_base_path_name = EditorPaths::get_singleton()->get_cache_dir().path_join(pkg_name); + tmp_base_path_name = EditorPaths::get_singleton()->get_temp_dir().path_join(pkg_name); tmp_app_path_name = tmp_base_path_name.path_join(tmp_app_dir_name); scr_path = tmp_base_path_name.path_join(pkg_name + ".command"); } @@ -1987,9 +1987,9 @@ Error EditorExportPlatformMacOS::export_project(const Ref &p bool sandbox = p_preset->get("codesign/entitlements/app_sandbox/enabled"); String ent_path = p_preset->get("codesign/entitlements/custom_file"); - String hlp_ent_path = sandbox ? EditorPaths::get_singleton()->get_cache_dir().path_join(pkg_name + "_helper.entitlements") : ent_path; + String hlp_ent_path = sandbox ? EditorPaths::get_singleton()->get_temp_dir().path_join(pkg_name + "_helper.entitlements") : ent_path; if (sign_enabled && (ent_path.is_empty())) { - ent_path = EditorPaths::get_singleton()->get_cache_dir().path_join(pkg_name + ".entitlements"); + ent_path = EditorPaths::get_singleton()->get_temp_dir().path_join(pkg_name + ".entitlements"); Ref ent_f = FileAccess::open(ent_path, FileAccess::WRITE); if (ent_f.is_valid()) { @@ -2269,7 +2269,7 @@ Error EditorExportPlatformMacOS::export_project(const Ref &p } else if (export_format == "app" && noto_enabled) { // Create temporary ZIP. if (err == OK) { - noto_path = EditorPaths::get_singleton()->get_cache_dir().path_join(pkg_name + ".zip"); + noto_path = EditorPaths::get_singleton()->get_temp_dir().path_join(pkg_name + ".zip"); if (ep.step(TTR("Making ZIP"), 3)) { return ERR_SKIP; @@ -2554,7 +2554,7 @@ Error EditorExportPlatformMacOS::run(const Ref &p_preset, in EditorProgress ep("run", TTR("Running..."), 5); - const String dest = EditorPaths::get_singleton()->get_cache_dir().path_join("macos"); + const String dest = EditorPaths::get_singleton()->get_temp_dir().path_join("macos"); Ref da = DirAccess::create(DirAccess::ACCESS_FILESYSTEM); if (!da->dir_exists(dest)) { Error err = da->make_dir_recursive(dest); diff --git a/platform/web/export/editor_http_server.cpp b/platform/web/export/editor_http_server.cpp index 9cf862eb1ed..26b9a626db0 100644 --- a/platform/web/export/editor_http_server.cpp +++ b/platform/web/export/editor_http_server.cpp @@ -86,7 +86,7 @@ void EditorHTTPServer::_send_response() { const String req_file = path.get_file(); const String req_ext = path.get_extension(); - const String cache_path = EditorPaths::get_singleton()->get_cache_dir().path_join("web"); + const String cache_path = EditorPaths::get_singleton()->get_temp_dir().path_join("web"); const String filepath = cache_path.path_join(req_file); if (!mimes.has(req_ext) || !FileAccess::exists(filepath)) { diff --git a/platform/web/export/export_plugin.cpp b/platform/web/export/export_plugin.cpp index 9e60a76fdc2..9d212d81ffe 100644 --- a/platform/web/export/export_plugin.cpp +++ b/platform/web/export/export_plugin.cpp @@ -817,7 +817,7 @@ Error EditorExportPlatformWeb::run(const Ref &p_preset, int } Error EditorExportPlatformWeb::_export_project(const Ref &p_preset, int p_debug_flags) { - const String dest = EditorPaths::get_singleton()->get_cache_dir().path_join("web"); + const String dest = EditorPaths::get_singleton()->get_temp_dir().path_join("web"); Ref da = DirAccess::create(DirAccess::ACCESS_FILESYSTEM); if (!da->dir_exists(dest)) { Error err = da->make_dir_recursive(dest); diff --git a/platform/windows/export/export_plugin.cpp b/platform/windows/export/export_plugin.cpp index 8d3f4bb2691..65fbc59310f 100644 --- a/platform/windows/export/export_plugin.cpp +++ b/platform/windows/export/export_plugin.cpp @@ -257,7 +257,7 @@ Error EditorExportPlatformWindows::export_project(const Ref // Setup temp folder. String path = p_path; - String tmp_dir_path = EditorPaths::get_singleton()->get_cache_dir().path_join(pkg_name); + String tmp_dir_path = EditorPaths::get_singleton()->get_temp_dir().path_join(pkg_name); Ref tmp_app_dir = DirAccess::create_for_path(tmp_dir_path); if (export_as_zip) { if (tmp_app_dir.is_null()) { @@ -501,7 +501,7 @@ Error EditorExportPlatformWindows::_rcedit_add_data(const Refget_cache_dir().path_join("_rcedit.ico"); + String tmp_icon_path = EditorPaths::get_singleton()->get_temp_dir().path_join("_rcedit.ico"); if (!icon_path.is_empty()) { if (_process_icon(p_preset, icon_path, tmp_icon_path) != OK) { add_message(EXPORT_MESSAGE_WARNING, TTR("Resources Modification"), vformat(TTR("Invalid icon file \"%s\"."), icon_path)); @@ -1004,7 +1004,7 @@ Error EditorExportPlatformWindows::run(const Ref &p_preset, EditorProgress ep("run", TTR("Running..."), 5); - const String dest = EditorPaths::get_singleton()->get_cache_dir().path_join("windows"); + const String dest = EditorPaths::get_singleton()->get_temp_dir().path_join("windows"); Ref da = DirAccess::create(DirAccess::ACCESS_FILESYSTEM); if (!da->dir_exists(dest)) { Error err = da->make_dir_recursive(dest);