summaryrefslogtreecommitdiff
path: root/platform/android/export
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2015-05-01 23:21:27 -0300
committerJuan Linietsky <reduzio@gmail.com>2015-05-01 23:21:27 -0300
commit524d9fad59cd596bb291648c8c2e1b4a46fb2d02 (patch)
tree74358f52db014f1ee4b899ddd1557ddc2945e641 /platform/android/export
parent61e90385f6cbeebb8d3d03c33078802c2fa11eda (diff)
-fixed godot icon for android
-added a genname option to generate the name of android app
Diffstat (limited to 'platform/android/export')
-rw-r--r--platform/android/export/export.cpp37
1 files changed, 32 insertions, 5 deletions
diff --git a/platform/android/export/export.cpp b/platform/android/export/export.cpp
index d0e2dfbce1..d169ec51d5 100644
--- a/platform/android/export/export.cpp
+++ b/platform/android/export/export.cpp
@@ -225,6 +225,8 @@ class EditorExportPlatformAndroid : public EditorExportPlatform {
static void _device_poll_thread(void *ud);
+ String get_package_name();
+
String get_project_name() const;
void _fix_manifest(Vector<uint8_t>& p_manifest);
void _fix_resources(Vector<uint8_t>& p_manifest);
@@ -756,7 +758,7 @@ void EditorExportPlatformAndroid::_fix_manifest(Vector<uint8_t>& p_manifest) {
if (tname=="manifest" && attrname=="package") {
print_line("FOUND PACKAGE");
- string_table[attr_value]=package;
+ string_table[attr_value]=get_package_name();
}
//print_line("tname: "+tname);
@@ -1169,7 +1171,7 @@ Error EditorExportPlatformAndroid::export_project(const String& p_path, bool p_d
if (apk_expansion) {
- String apkfname="main."+itos(version_code)+"."+package+".obb";
+ String apkfname="main."+itos(version_code)+"."+get_package_name()+".obb";
String fullpath=p_path.get_base_dir().plus_file(apkfname);
FileAccess *pf = FileAccess::open(fullpath,FileAccess::WRITE);
if (!pf) {
@@ -1514,7 +1516,7 @@ Error EditorExportPlatformAndroid::run(int p_device, bool p_dumb) {
args.push_back("-s");
args.push_back(devices[p_device].id);
args.push_back("uninstall");
- args.push_back(package);
+ args.push_back(get_package_name());
err = OS::get_singleton()->execute(adb,args,true,NULL,NULL,&rv);
#if 0
@@ -1552,7 +1554,7 @@ Error EditorExportPlatformAndroid::run(int p_device, bool p_dumb) {
args.push_back("-a");
args.push_back("android.intent.action.MAIN");
args.push_back("-n");
- args.push_back(package+"/com.android.godot.Godot");
+ args.push_back(get_package_name()+"/com.android.godot.Godot");
err = OS::get_singleton()->execute(adb,args,true,NULL,NULL,&rv);
if (err || rv!=0) {
@@ -1564,12 +1566,37 @@ Error EditorExportPlatformAndroid::run(int p_device, bool p_dumb) {
return OK;
}
+String EditorExportPlatformAndroid::get_package_name() {
+
+ String pname = package;
+ String basename = Globals::get_singleton()->get("application/name");
+ basename=basename.to_lower();
+
+ String name;
+ bool first=true;
+ for(int i=0;i<basename.length();i++) {
+ CharType c = basename[i];
+ if (c>='0' && c<='9' && first) {
+ continue;
+ }
+ if ((c>='a' && c<='z') || (c>='A' && c<='Z') || (c>='0' && c<='9')) {
+ name+=String::chr(c);
+ first=false;
+ }
+ }
+ if (name=="")
+ name="noname";
+
+ pname=pname.replace("$genname",name);
+ return pname;
+
+}
EditorExportPlatformAndroid::EditorExportPlatformAndroid() {
version_code=1;
version_name="1.0";
- package="com.android.noname";
+ package="org.godotengine.$genname";
name="";
_signed=true;
apk_expansion=false;