1
0
mirror of https://github.com/janet-lang/janet synced 2024-11-28 02:59:54 +00:00

Merge pull request #1472 from Andriamanitra/compile-default-output-file

Add default output path for --compile (-c)
This commit is contained in:
Calvin Rose 2024-07-08 05:14:33 -07:00 committed by GitHub
commit 31f0ff0d84
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -4475,7 +4475,13 @@
"c" (fn c-switch [i &] "c" (fn c-switch [i &]
(def path (in args (+ i 1))) (def path (in args (+ i 1)))
(def e (dofile path)) (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) (set no-file false)
3) 3)
"-" (fn [&] (set handleopts false) 1) "-" (fn [&] (set handleopts false) 1)