diff options
author | est31 <MTest31@outlook.com> | 2015-11-30 01:26:51 +0100 |
---|---|---|
committer | est31 <MTest31@outlook.com> | 2015-11-30 01:36:08 +0100 |
commit | 15f6d3cebf9e8c9288132454816f1152e16dde36 (patch) | |
tree | 21ebe9b3a928e682f195e66cc171f3c05efacd3a /platform/android | |
parent | 5e0419012a00631aac200739680b04446285eb14 (diff) |
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
Diffstat (limited to 'platform/android')
-rw-r--r-- | platform/android/export/export.cpp | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/platform/android/export/export.cpp b/platform/android/export/export.cpp index 1deeb3457a..7d550f4fa0 100644 --- a/platform/android/export/export.cpp +++ b/platform/android/export/export.cpp @@ -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"; } |