Add way to look for templates at system wide level too
Useful for everybody wanting to package godot. Fixes #1026. -> Retain the old behaviour: path in error msg only when exporting. -> User templates override system templates
This commit is contained in:
parent
5e0419012a
commit
15f6d3cebf
10 changed files with 128 additions and 54 deletions
|
|
@ -1020,18 +1020,24 @@ Error EditorExportPlatformAndroid::export_project(const String& p_path, bool p_d
|
|||
|
||||
EditorProgress ep("export","Exporting for Android",104);
|
||||
|
||||
String apk_path = EditorSettings::get_singleton()->get_settings_path()+"/templates/";
|
||||
|
||||
if (p_debug) {
|
||||
|
||||
src_apk=custom_debug_package!=""?custom_debug_package:apk_path+"android_debug.apk";
|
||||
} else {
|
||||
|
||||
src_apk=custom_release_package!=""?custom_release_package:apk_path+"android_release.apk";
|
||||
if (p_debug)
|
||||
src_apk=custom_debug_package;
|
||||
else
|
||||
src_apk=custom_release_package;
|
||||
|
||||
if (src_apk=="") {
|
||||
String err;
|
||||
if (p_debug) {
|
||||
src_apk=find_export_template("android_debug.apk", &err);
|
||||
} else {
|
||||
src_apk=find_export_template("android_release.apk", &err);
|
||||
}
|
||||
if (src_apk=="") {
|
||||
EditorNode::add_io_error(err);
|
||||
return ERR_FILE_NOT_FOUND;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
FileAccess *src_f=NULL;
|
||||
zlib_filefunc_def io = zipio_create_io_from_file(&src_f);
|
||||
|
||||
|
|
@ -1659,10 +1665,7 @@ bool EditorExportPlatformAndroid::can_export(String *r_error) const {
|
|||
err+="Debug Keystore not configured in editor settings.\n";
|
||||
}
|
||||
|
||||
|
||||
String exe_path = EditorSettings::get_singleton()->get_settings_path()+"/templates/";
|
||||
|
||||
if (!FileAccess::exists(exe_path+"android_debug.apk") || !FileAccess::exists(exe_path+"android_release.apk")) {
|
||||
if (!exists_export_template("android_debug.apk") || !exists_export_template("android_release.apk")) {
|
||||
valid=false;
|
||||
err+="No export templates found.\nDownload and install export templates.\n";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -275,10 +275,16 @@ Error EditorExportPlatformBB10::export_project(const String& p_path, bool p_debu
|
|||
|
||||
EditorProgress ep("export","Exporting for BlackBerry 10",104);
|
||||
|
||||
String template_path = EditorSettings::get_singleton()->get_settings_path()+"/templates/";
|
||||
|
||||
String src_template=custom_package!=""?custom_package:template_path.plus_file("bb10.zip");
|
||||
String src_template=custom_package;
|
||||
|
||||
if (src_template=="") {
|
||||
String err;
|
||||
src_template = find_export_template("bb10.zip", &err);
|
||||
if (src_template=="") {
|
||||
EditorNode::add_io_error(err);
|
||||
return ERR_FILE_NOT_FOUND;
|
||||
}
|
||||
}
|
||||
|
||||
FileAccess *src_f=NULL;
|
||||
zlib_filefunc_def io = zipio_create_io_from_file(&src_f);
|
||||
|
|
@ -733,9 +739,7 @@ bool EditorExportPlatformBB10::can_export(String *r_error) const {
|
|||
err+="Blackberry host tools not configured in editor settings.\n";
|
||||
}
|
||||
|
||||
String exe_path = EditorSettings::get_singleton()->get_settings_path()+"/templates/";
|
||||
|
||||
if (!FileAccess::exists(exe_path+"bb10.zip")) {
|
||||
if (!exists_export_template("bb10.zip")) {
|
||||
valid=false;
|
||||
err+="No export template found.\nDownload and install export templates.\n";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -205,18 +205,24 @@ Error EditorExportPlatformJavaScript::export_project(const String& p_path, bool
|
|||
|
||||
EditorProgress ep("export","Exporting for javascript",104);
|
||||
|
||||
String template_path = EditorSettings::get_singleton()->get_settings_path()+"/templates/";
|
||||
|
||||
if (p_debug) {
|
||||
|
||||
src_template=custom_debug_package!=""?custom_debug_package:template_path+"javascript_debug.zip";
|
||||
} else {
|
||||
|
||||
src_template=custom_release_package!=""?custom_release_package:template_path+"javascript_release.zip";
|
||||
if (p_debug)
|
||||
src_template=custom_debug_package;
|
||||
else
|
||||
src_template=custom_release_package;
|
||||
|
||||
if (src_template=="") {
|
||||
String err;
|
||||
if (p_debug) {
|
||||
src_template=find_export_template("javascript_debug.zip", &err);
|
||||
} else {
|
||||
src_template=find_export_template("javascript_release.zip", &err);
|
||||
}
|
||||
if (src_template=="") {
|
||||
EditorNode::add_io_error(err);
|
||||
return ERR_FILE_NOT_FOUND;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
FileAccess *src_f=NULL;
|
||||
zlib_filefunc_def io = zipio_create_io_from_file(&src_f);
|
||||
|
||||
|
|
@ -337,9 +343,8 @@ bool EditorExportPlatformJavaScript::can_export(String *r_error) const {
|
|||
|
||||
bool valid=true;
|
||||
String err;
|
||||
String exe_path = EditorSettings::get_singleton()->get_settings_path()+"/templates/";
|
||||
|
||||
if (!FileAccess::exists(exe_path+"javascript_debug.zip") || !FileAccess::exists(exe_path+"javascript_release.zip")) {
|
||||
if (!exists_export_template("javascript_debug.zip") || !exists_export_template("javascript_release.zip")) {
|
||||
valid=false;
|
||||
err+="No export templates found.\nDownload and install export templates.\n";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -251,15 +251,19 @@ Error EditorExportPlatformOSX::export_project(const String& p_path, bool p_debug
|
|||
|
||||
EditorProgress ep("export","Exporting for OSX",104);
|
||||
|
||||
String pkg_path = EditorSettings::get_singleton()->get_settings_path()+"/templates/osx.zip";
|
||||
|
||||
if (p_debug) {
|
||||
|
||||
src_pkg=custom_debug_package!=""?custom_debug_package:pkg_path;
|
||||
} else {
|
||||
|
||||
src_pkg=custom_release_package!=""?custom_release_package:pkg_path;
|
||||
if (p_debug)
|
||||
src_pkg=custom_debug_package;
|
||||
else
|
||||
src_pkg=custom_release_package;
|
||||
|
||||
if (src_pkg=="") {
|
||||
String err;
|
||||
src_pkg=find_export_template("osx.zip", &err);
|
||||
if (src_pkg=="") {
|
||||
EditorNode::add_io_error(err);
|
||||
return ERR_FILE_NOT_FOUND;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -464,9 +468,8 @@ bool EditorExportPlatformOSX::can_export(String *r_error) const {
|
|||
|
||||
bool valid=true;
|
||||
String err;
|
||||
String exe_path = EditorSettings::get_singleton()->get_settings_path()+"/templates/";
|
||||
|
||||
if (!FileAccess::exists(exe_path+"osx.zip")) {
|
||||
if (!exists_export_template("osx.zip")) {
|
||||
valid=false;
|
||||
err+="No export templates found.\nDownload and install export templates.\n";
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue