add PLTUSERHOME

The new `PLTUSERHOME` environment variable redirects all of the
user-specific paths reported by `find-system-path`.

Also, improve the tests for `raco exe` (particularly the bug
fixed in 6cb6f3fbf1) using `PLTUSERHOME`.

original commit: e4ce0d0331
This commit is contained in:
Matthew Flatt 2014-02-25 14:54:40 -07:00
parent 6aec40ebfb
commit ec06cc8428

View File

@ -53,7 +53,12 @@
(let ([plthome (getenv "PLTHOME")]
[collects (getenv "PLTCOLLECTS")]
[out (open-output-string)])
(define temp-home-dir (make-temporary-file "racket-tmp-home~a" 'directory))
;; Try to hide usual collections:
(parameterize ([current-environment-variables
(environment-variables-copy
(current-environment-variables))])
(putenv "PLTUSERHOME" (path->string temp-home-dir))
(when plthome
(putenv "PLTHOME" (path->string (build-path (find-system-path 'temp-dir) "NOPE"))))
(when collects
@ -70,11 +75,8 @@
(test #t
path
(parameterize ([current-output-port out])
(system* path)))))
(when plthome
(putenv "PLTHOME" plthome))
(when collects
(putenv "PLTCOLLECTS" collects))
(system* path))))))
(delete-directory/files temp-home-dir)
(let ([stdout-file (build-path (find-system-path 'temp-dir) "stdout")])
(if (file-exists? stdout-file)
(test expect with-input-from-file stdout-file