diff --git a/collects/mzlib/sandbox.ss b/collects/mzlib/sandbox.ss index 9515b8a8c3..27f77db42d 100644 --- a/collects/mzlib/sandbox.ss +++ b/collects/mzlib/sandbox.ss @@ -509,8 +509,12 @@ [reqs (cond [(not requires) '()] [(not (list? requires)) (error 'make-evaluator "bad requires: ~e" requires)] - [else (map (lambda (r) (if (pair? r) r `(file ,r))) - requires)])]) + [else + (map (lambda (r) + (if (or (pair? r) (symbol? r)) + r + `(file ,(path->string (simplify-path* r))))) + requires)])]) (make-evaluator* (init-for-language lang) (require-perms lang reqs) (lambda () (build-program lang reqs input-program))))] diff --git a/collects/tests/mzscheme/sandbox.ss b/collects/tests/mzscheme/sandbox.ss index 5d159cca68..ccda20c931 100644 --- a/collects/tests/mzscheme/sandbox.ss +++ b/collects/tests/mzscheme/sandbox.ss @@ -165,7 +165,8 @@ (when (directory-exists? "/tmp") ; non-collects place to play with (let* ([mzlib (path->string (collection-path "mzlib"))] [list-lib (path->string (build-path mzlib "list.ss"))] - [test-lib "/tmp/sandbox-test.ss"]) + [test-lib (path->string (path->complete-path ; <- for windows + "/tmp/sandbox-test.ss"))]) (t --top-- (set! ev (make-evaluator 'mzscheme '())) --eval-- @@ -203,10 +204,15 @@ (directory-list "/tmp") =err> "file access denied" --top-- ;; explicitly allow access to /tmp - (set! ev (parameterize ([sandbox-path-permissions - `((read #rx#"^/tmp(?:/|$)") - ,@(sandbox-path-permissions))]) - (make-evaluator 'mzscheme '()))) + (set! ev (let ([rx (if (eq? 'windows (system-type)) + ;; on windows this will have a drive letter + #rx#"^[a-zA-Z]:[/\\]tmp(?:[/\\]|$)" + #rx#"^/tmp(?:/|$)")]) + (parameterize ([sandbox-path-permissions + ;; allow all `/tmp' paths for windows + `((read ,rx) + ,@(sandbox-path-permissions))]) + (make-evaluator 'mzscheme '())))) --eval-- (length (with-input-from-file ,test-lib read)) => 5 (list? (directory-list "/tmp"))