io: find-system-path and directory results

Use `path->directory-path` to ensure consistent trailing slashes.

Closes #2461
This commit is contained in:
Matthew Flatt 2019-02-07 09:06:50 -08:00
parent 2754d4e5a0
commit 5c775fa04c

View File

@ -21,27 +21,28 @@
init-current-directory!) init-current-directory!)
(define/who (find-system-path key) (define/who (find-system-path key)
(define (as-dir p) (path->directory-path p))
(begin0 (begin0
(case key (case key
[(exec-file) (or exec-file [(exec-file) (or exec-file
(string->path "/usr/local/bin/racket"))] (string->path "/usr/local/bin/racket"))]
[(run-file) (or run-file [(run-file) (or run-file
(find-system-path 'exec-file))] (find-system-path 'exec-file))]
[(config-dir host-config-dir) (or config-dir [(config-dir host-config-dir) (as-dir (or config-dir
(string->path "../etc"))] (string->path "../etc")))]
[(collects-dir host-collects-dir) (or collects-dir [(collects-dir host-collects-dir) (as-dir (or collects-dir
(string->path "../collects"))] (string->path "../collects")))]
[(orig-dir) orig-dir] [(orig-dir) (as-dir orig-dir)]
[(temp-dir) (rktio-system-path who RKTIO_PATH_TEMP_DIR)] [(temp-dir) (as-dir (rktio-system-path who RKTIO_PATH_TEMP_DIR))]
[(sys-dir) (rktio-system-path who RKTIO_PATH_SYS_DIR)] [(sys-dir) (as-dir (rktio-system-path who RKTIO_PATH_SYS_DIR))]
[(pref-dir) (rktio-system-path who RKTIO_PATH_PREF_DIR)] [(pref-dir) (as-dir (rktio-system-path who RKTIO_PATH_PREF_DIR))]
[(pref-file) (rktio-system-path who RKTIO_PATH_PREF_FILE)] [(pref-file) (as-dir (rktio-system-path who RKTIO_PATH_PREF_FILE))]
[(addon-dir) (or addon-dir [(addon-dir) (as-dir (or addon-dir
(rktio-system-path who RKTIO_PATH_ADDON_DIR))] (rktio-system-path who RKTIO_PATH_ADDON_DIR)))]
[(home-dir) (rktio-system-path who RKTIO_PATH_HOME_DIR)] [(home-dir) (as-dir (rktio-system-path who RKTIO_PATH_HOME_DIR))]
[(desk-dir) (rktio-system-path who RKTIO_PATH_DESK_DIR)] [(desk-dir) (as-dir (rktio-system-path who RKTIO_PATH_DESK_DIR))]
[(doc-dir) (rktio-system-path who RKTIO_PATH_DOC_DIR)] [(doc-dir) (as-dir (rktio-system-path who RKTIO_PATH_DOC_DIR))]
[(init-dir) (rktio-system-path who RKTIO_PATH_INIT_DIR)] [(init-dir) (as-dir (rktio-system-path who RKTIO_PATH_INIT_DIR))]
[(init-file) (rktio-system-path who RKTIO_PATH_INIT_FILE)] [(init-file) (rktio-system-path who RKTIO_PATH_INIT_FILE)]
[else (raise-argument-error who [else (raise-argument-error who
(string-append (string-append