Przeglądaj źródła

Create parent directories on export.

Fixes #42231.

This works for both the UI and the --export CLI flag.

(cherry picked from commit 66a278f585674ae4874ad52f1ffe9a90d5631b65)
Ryan Roden-Corrent 3 lat temu
rodzic
commit
5d7b3e10ee
1 zmienionych plików z 2 dodań i 7 usunięć
  1. 2 7
      editor/editor_export.cpp

+ 2 - 7
editor/editor_export.cpp

@@ -1624,10 +1624,6 @@ List<String> EditorExportPlatformPC::get_binary_extensions(const Ref<EditorExpor
 Error EditorExportPlatformPC::export_project(const Ref<EditorExportPreset> &p_preset, bool p_debug, const String &p_path, int p_flags) {
 Error EditorExportPlatformPC::export_project(const Ref<EditorExportPreset> &p_preset, bool p_debug, const String &p_path, int p_flags) {
 	ExportNotifier notifier(*this, p_preset, p_debug, p_path, p_flags);
 	ExportNotifier notifier(*this, p_preset, p_debug, p_path, p_flags);
 
 
-	if (!DirAccess::exists(p_path.get_base_dir())) {
-		return ERR_FILE_BAD_PATH;
-	}
-
 	String custom_debug = p_preset->get("custom_template/debug");
 	String custom_debug = p_preset->get("custom_template/debug");
 	String custom_release = p_preset->get("custom_template/release");
 	String custom_release = p_preset->get("custom_template/release");
 
 
@@ -1656,9 +1652,9 @@ Error EditorExportPlatformPC::export_project(const Ref<EditorExportPreset> &p_pr
 		return ERR_FILE_NOT_FOUND;
 		return ERR_FILE_NOT_FOUND;
 	}
 	}
 
 
-	DirAccess *da = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
+	DirAccessRef da = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
+	da->make_dir_recursive(p_path.get_base_dir());
 	Error err = da->copy(template_path, p_path, get_chmod_flags());
 	Error err = da->copy(template_path, p_path, get_chmod_flags());
-	memdelete(da);
 
 
 	if (err == OK) {
 	if (err == OK) {
 		String pck_path;
 		String pck_path;
@@ -1694,7 +1690,6 @@ Error EditorExportPlatformPC::export_project(const Ref<EditorExportPreset> &p_pr
 					err = sign_shared_object(p_preset, p_debug, p_path.get_base_dir().plus_file(so_files[i].path.get_file()));
 					err = sign_shared_object(p_preset, p_debug, p_path.get_base_dir().plus_file(so_files[i].path.get_file()));
 				}
 				}
 			}
 			}
-			memdelete(da);
 		}
 		}
 	}
 	}