nitc android: move android specific folders (res/libs) to an android folder
authorAlexis Laferrière <alexis.laf@xymus.net>
Wed, 17 Feb 2016 13:52:00 +0000 (08:52 -0500)
committerAlexis Laferrière <alexis.laf@xymus.net>
Wed, 17 Feb 2016 18:03:07 +0000 (13:03 -0500)
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

src/platform/android.nit

index 20e1f3a..bab5983 100644 (file)
@@ -113,10 +113,22 @@ class AndroidToolchain
                end
 
                # Is there an icon?
+               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
+
                var resolutions = ["ldpi", "mdpi", "hdpi", "xhdpi", "xxhdpi", "xxxhdpi"]
                var icon_available = false
                for res in resolutions do
-                       var path = "res/drawable-{res}/icon.png"
+                       var path = project_root / "android/res/drawable-{res}/icon.png"
                        if path.file_exists then
                                icon_available = true
                                break
@@ -255,18 +267,6 @@ $(call import-module,android/native_app_glue)
 
                # Copy assets, resources and libs where expected by the SDK
 
-               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
-
                # Link to assets (for mnit and others)
                var assets_dir = project_root / "assets"
                if assets_dir.file_exists then
@@ -278,7 +278,7 @@ $(call import-module,android/native_app_glue)
                end
 
                # Copy the res folder
-               var res_dir = project_root / "res"
+               var res_dir = project_root / "android/res"
                if res_dir.file_exists then
                        # copy the res folder to the compile dir
                        res_dir = res_dir.realpath
@@ -294,7 +294,7 @@ $(call import-module,android/native_app_glue)
                end
 
                # Copy the libs folder
-               var libs_dir = project_root / "libs"
+               var libs_dir = project_root / "android/libs"
                if libs_dir.file_exists then
                        toolcontext.exec_and_check(["cp", "-r", libs_dir, android_project_root], "Android project error")
                end