@@ -20,8 +20,7 @@ module svg_to_icons
20
20
import opts
21
21
22
22
redef class Int
23
- fun android_path : String do return "drawable- {resolution_name } /icon.png "
24
-
23
+ # Android name for this resolution
25
24
fun resolution_name : String
26
25
do
27
26
if self == 36 then return "ldpi "
37
36
var opt_out = new OptionString ("Where to output PNG files " , "--out " , "-o " )
38
37
var opt_id = new OptionString ("Extract only object with given ID " , "--id " , "-i " )
39
38
var opt_android = new OptionBool ("Generate in the file structure for Android " , "--android " , "-a " )
39
+ var opt_android_name = new OptionString ("Name of the resource for Android " , "--name " , "-n " )
40
40
var opt_large = new OptionBool ("Generate large icons (512 and 1024 px) " , "--large " , "-l " )
41
41
var opt_help = new OptionBool ("Print this help message " , "--help " , "-h " )
42
42
43
43
var opt_context = new OptionContext
44
- opt_context .add_option (opt_out , opt_id , opt_android , opt_large , opt_help )
44
+ opt_context .add_option (opt_out , opt_id , opt_android , opt_android_name , opt_large , opt_help )
45
45
46
46
opt_context .parse (args )
47
47
var rest = opt_context .rest
@@ -83,10 +83,12 @@ else if opt_large.value then
83
83
resolutions = [512 , 1024 ]
84
84
else abort
85
85
86
+ var android_res_name = opt_android_name .value or else "icon "
87
+
86
88
for wh in resolutions do
87
89
var png_path
88
90
if opt_android .value then
89
- png_path = " { out_path } / { wh .android_path } "
91
+ png_path = out_path / " drawable- " + wh .resolution_name / android_res_name + " .png "
90
92
var dir = png_path .dirname
91
93
if not dir .file_exists then dir .mkdir
92
94
else
0 commit comments