From f8dd9f3359a21c47d8920388b6233f43ceae988f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Alexis=20Laferri=C3=A8re?= Date: Thu, 16 Apr 2015 11:40:44 -0400 Subject: [PATCH] contrib/inkscape_tools: add option for the full path to the generated source MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Alexis Laferrière --- contrib/inkscape_tools/src/svg_to_png_and_nit.nit | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/contrib/inkscape_tools/src/svg_to_png_and_nit.nit b/contrib/inkscape_tools/src/svg_to_png_and_nit.nit index 5398903..db6631f 100644 --- a/contrib/inkscape_tools/src/svg_to_png_and_nit.nit +++ b/contrib/inkscape_tools/src/svg_to_png_and_nit.nit @@ -97,7 +97,7 @@ redef class Int end end -var opt_out_src = new OptionString("Path to output source file", "--src", "-s") +var opt_out_src = new OptionString("Path to output source file (folder or file)", "--src", "-s") var opt_assets = new OptionString("Path to assert dir where to put PNG files", "--assets", "-a") var opt_scale = new OptionFloat("Apply scaling to exported images (default at 1.0 of 90dpi)", 1.0, "--scale", "-x") var opt_help = new OptionBool("Print this help message", "--help", "-h") @@ -139,7 +139,7 @@ end var src_path = opt_out_src.value if src_path == null then src_path = "src" -if not src_path.file_exists then +if not src_path.file_exists and src_path.file_extension != "nit" then stderr.write "Source dir '{src_path}' does not exist (use --src)\n" exit 1 end @@ -253,8 +253,12 @@ for drawing in drawings do end end + if not src_path.file_extension == "nit" then + src_path = src_path/drawing_name+".nit" + end + # Output source file - var src_file = new FileWriter.open("{src_path}/{drawing_name}.nit") + var src_file = new FileWriter.open(src_path) nit_src.write_to(src_file) src_file.close -- 1.7.9.5