Skip to content

Commit

Permalink
Merge pull request #1472 from Andriamanitra/compile-default-output-file
Browse files Browse the repository at this point in the history
Add default output path for --compile (-c)
  • Loading branch information
bakpakin authored Jul 8, 2024
2 parents 190056b + b7b5942 commit 31f0ff0
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/boot/boot.janet
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 31f0ff0

Please sign in to comment.