+
+ ### copy resources (for android)
+ # This will be accessed from `android_project_root`
+ var res_dir
+ if compiler.mainmodule.location.file != null then
+ # it is a real file, use "{file}/../res"
+ res_dir = "{compiler.mainmodule.location.file.filename.dirname}/../res"
+ else
+ # probably used -m, use "."
+ res_dir = "res"
+ end
+ if res_dir.file_exists then
+ # copy the res folder to .nit_compile
+ res_dir = res_dir.realpath
+ var target_res_dir = "{android_project_root}"
+ toolcontext.exec_and_check(["cp", "-R", res_dir, target_res_dir], "Android project error")
+ else
+ # Create our own custom `res/values/string.xml` with the App name
+"""<?xml version="1.0" encoding="utf-8"?>
+<resources>
+ <string name="app_name">{{{app_name}}}</string>
+</resources>""".write_to_file "{dir}/res/values/strings.xml"
+ end