From b7b594205c52d094b59023f8e32793b27d8cfcce Mon Sep 17 00:00:00 2001 From: Andriamanitra Date: Mon, 8 Jul 2024 11:55:50 +0300 Subject: [PATCH] Add default output path for --compile (-c) --- src/boot/boot.janet | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/boot/boot.janet b/src/boot/boot.janet index 66f9ff9e..4f384efa 100644 --- a/src/boot/boot.janet +++ b/src/boot/boot.janet @@ -4475,7 +4475,13 @@ "c" (fn c-switch [i &] (def path (in args (+ i 1))) (def e (dofile path)) - (spit (in args (+ i 2)) (make-image e)) + (def output-path + (if (< (+ i 2) (length args)) + (in args (+ i 2)) + (string + (if (string/has-suffix? ".janet" path) (string/slice path 0 -7) path) + ".jimage"))) + (spit output-path (make-image e)) (set no-file false) 3) "-" (fn [&] (set handleopts false) 1)