cs: add support for -A

This commit is contained in:
Matthew Flatt 2018-10-20 20:28:17 -06:00
parent de98529c13
commit 51258bc77c
4 changed files with 20 additions and 3 deletions

View File

@ -183,6 +183,7 @@
(define exit-value 0)
(define host-collects-dir init-collects-dir)
(define host-config-dir init-config-dir)
(define addon-dir #f)
(define (no-init! saw)
(unless (saw? saw 'top)
@ -330,6 +331,10 @@
(when init-library
(set! init-library `(lib ,lib-name)))
(loop rest-args))]
[("-A" "--addon")
(let-values ([(addon-path rest-args) (next-arg "addon directory" arg within-arg args)])
(set! addon-dir addon-path)
(loop rest-args))]
[("-X" "--collects")
(let-values ([(collects-path rest-args) (next-arg "collects path" arg within-arg args)])
(cond
@ -545,6 +550,11 @@
(let ([f (dynamic-require mod sym)])
(f pch)))))
(let ([a (or addon-dir
(getenv "PLTADDONDIR"))])
(when a
(set-addon-dir! (path->complete-path a))))
(when (getenv "PLT_STATS_ON_BREAK")
(keyboard-interrupt-handler
(let ([orig (keyboard-interrupt-handler)])

View File

@ -26,7 +26,8 @@ GLOBALS = --no-global \
++global-ok exec-file \
++global-ok run-file \
++global-ok collects-dir \
++global-ok config-dir
++global-ok config-dir \
++global-ok addon-dir
io-src: $(RKTIO_DEP)
$(RACO) make ../expander/bootstrap-run.rkt

View File

@ -60,6 +60,7 @@
set-run-file!
set-collects-dir!
set-config-dir!
set-addon-dir!
_path)

View File

@ -10,7 +10,8 @@
set-exec-file!
set-run-file!
set-collects-dir!
set-config-dir!)
set-config-dir!
set-addon-dir!)
(define/who (find-system-path key)
(begin0
@ -28,7 +29,8 @@
[(sys-dir) (rktio-system-path who RKTIO_PATH_SYS_DIR)]
[(pref-dir) (rktio-system-path who RKTIO_PATH_PREF_DIR)]
[(pref-file) (rktio-system-path who RKTIO_PATH_PREF_FILE)]
[(addon-dir) (rktio-system-path who RKTIO_PATH_ADDON_DIR)]
[(addon-dir) (or addon-dir
(rktio-system-path who RKTIO_PATH_ADDON_DIR))]
[(home-dir) (rktio-system-path who RKTIO_PATH_HOME_DIR)]
[(desk-dir) (rktio-system-path who RKTIO_PATH_DESK_DIR)]
[(doc-dir) (rktio-system-path who RKTIO_PATH_DOC_DIR)]
@ -56,6 +58,9 @@
(define config-dir #f)
(define (set-config-dir! p) (set! config-dir p))
(define addon-dir #f)
(define (set-addon-dir! p) (set! addon-dir p))
(define (rktio-system-path who key)
(start-atomic)
(define s (rktio_system_path rktio key))