+ if f isa ExternCFile then cfiles.add(f.filename.basename)
+ end
+
+ var project_root = "."
+ var mpackage = compiler.mainmodule.first_real_mmodule.mpackage
+ if mpackage != null then
+ var root = mpackage.root
+ if root != null then
+ var filepath = root.filepath
+ if filepath != null then
+ project_root = filepath
+ end
+ end
+ end
+
+ # Set the default pretty application name
+"""<?xml version="1.0" encoding="utf-8"?>
+<resources>
+ <string name="app_name">{{{app_name}}}</string>
+</resources>""".write_to_file "{android_project_root}/res/values/strings.xml"
+
+ # Copy assets, resources and libs where expected by the SDK
+
+ ## Collect path to all possible folder where we can find the `android` folder
+ var app_files = [project_root]
+ app_files.add_all project.files
+
+ for path in app_files do
+ # Copy the assets folder
+ var assets_dir = path / "assets"
+ if assets_dir.file_exists then
+ assets_dir = assets_dir.realpath
+ toolcontext.exec_and_check(["cp", "-r", assets_dir, android_project_root], "Android project error")
+ end
+
+ # Copy the whole `android` folder
+ var android_dir = path / "android"
+ if android_dir.file_exists then
+ android_dir = android_dir.realpath
+ toolcontext.exec_and_check(["cp", "-r", android_dir, root_compile_dir], "Android project error")
+ end