summaryrefslogtreecommitdiff
path: root/editor/editor_export.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'editor/editor_export.cpp')
-rw-r--r--editor/editor_export.cpp57
1 files changed, 44 insertions, 13 deletions
diff --git a/editor/editor_export.cpp b/editor/editor_export.cpp
index bbc5d7dbd1..e2a7011ccb 100644
--- a/editor/editor_export.cpp
+++ b/editor/editor_export.cpp
@@ -315,17 +315,20 @@ Error EditorExportPlatform::_save_zip_file(void *p_userdata, const String &p_pat
return OK;
}
-String EditorExportPlatform::find_export_template(String template_file_name, String *err) const {
+String EditorExportPlatform::find_export_template(String template_file_name) const {
- String user_file = EditorSettings::get_singleton()->get_settings_path() + "/templates/" + itos(VERSION_MAJOR) + "." + itos(VERSION_MINOR) + "." + _MKSTR(VERSION_STATUS) + "/" + template_file_name;
+ String base_name = itos(VERSION_MAJOR) + "." + itos(VERSION_MINOR) + "-" + _MKSTR(VERSION_STATUS) + "/" + template_file_name;
+ String user_file = EditorSettings::get_singleton()->get_settings_path() + "/templates/" + base_name;
String system_file = OS::get_singleton()->get_installed_templates_path();
bool has_system_path = (system_file != "");
- system_file += template_file_name;
+ system_file = system_file.plus_file(base_name);
+ print_line("test user file: " + user_file);
// Prefer user file
if (FileAccess::exists(user_file)) {
return user_file;
}
+ print_line("test system file: " + system_file);
// Now check system file
if (has_system_path) {
@@ -333,16 +336,9 @@ String EditorExportPlatform::find_export_template(String template_file_name, Str
return system_file;
}
}
+ print_line("none,sorry");
- // Not found
- if (err) {
- *err += "No export template found at \"" + user_file + "\"";
- if (has_system_path)
- *err += "\n or \"" + system_file + "\".";
- else
- *err += ".";
- }
- return "";
+ return String(); //not found
}
Ref<EditorExportPreset> EditorExportPlatform::create_preset() {
@@ -880,7 +876,42 @@ String EditorExportPlatformPC::get_binary_extension() const {
Error EditorExportPlatformPC::export_project(const Ref<EditorExportPreset> &p_preset, bool p_debug, const String &p_path, int p_flags) {
- return OK;
+ String custom_debug = p_preset->get("custom_template/debug");
+ String custom_release = p_preset->get("custom_template/release");
+
+ String template_path = p_debug ? custom_debug : custom_release;
+
+ template_path = template_path.strip_edges();
+
+ if (template_path == String()) {
+
+ if (p_preset->get("binary_format/64_bits")) {
+ if (p_debug) {
+ template_path = find_export_template(debug_file_64);
+ } else {
+ template_path = find_export_template(release_file_64);
+ }
+ } else {
+ if (p_debug) {
+ template_path = find_export_template(debug_file_32);
+ } else {
+ template_path = find_export_template(release_file_32);
+ }
+ }
+ }
+
+ if (template_path != String() && !FileAccess::exists(template_path)) {
+ EditorNode::get_singleton()->show_warning(TTR("Template file not found:\n") + template_path);
+ return ERR_FILE_NOT_FOUND;
+ }
+
+ DirAccess *da = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
+ da->copy(template_path, p_path);
+ memdelete(da);
+
+ String pck_path = p_path.get_basename() + ".pck";
+
+ return save_pack(p_preset, pck_path);
}
void EditorExportPlatformPC::set_extension(const String &p_extension) {