fix handling of empty paths in PATH on Windows

Check for an empty path after dropping `"`s, instead of before.
Otherwise, a bad PATH setting interferes with functions like
`find-executable-path`, which in turn can prevent DrRacket from
starting up.

Closes PR 14930
This commit is contained in:
Matthew Flatt 2015-01-13 06:48:40 -07:00
parent 719917f812
commit 33da6564a1
3 changed files with 740 additions and 739 deletions

File diff suppressed because it is too large Load Diff

View File

@ -293,12 +293,13 @@
" \":\")))" " \":\")))"
" (format \"([^~a]*)~a(.*)\" sep sep)))))" " (format \"([^~a]*)~a(.*)\" sep sep)))))"
"(cons-path(lambda(default s l) " "(cons-path(lambda(default s l) "
"(let((s(if(eq?(system-type) 'windows)"
" (regexp-replace* #rx#\"\\\"\" s #\"\")"
" s)))"
" (if (bytes=? s #\"\")" " (if (bytes=? s #\"\")"
"(append default l)" "(append default l)"
"(cons(bytes->path(if(eq?(system-type) 'windows)" "(cons(bytes->path s)"
" (regexp-replace* #rx#\"\\\"\" s #\"\")" " l))))))"
" s))"
" l)))))"
"(lambda(s default)" "(lambda(s default)"
"(unless(or(bytes? s)" "(unless(or(bytes? s)"
"(string? s))" "(string? s))"

View File

@ -349,12 +349,13 @@
":"))) ":")))
(format "([^~a]*)~a(.*)" sep sep))))) (format "([^~a]*)~a(.*)" sep sep)))))
(cons-path (lambda (default s l) (cons-path (lambda (default s l)
(if (bytes=? s #"") (let ([s (if (eq? (system-type) 'windows)
(append default l) (regexp-replace* #rx#"\"" s #"")
(cons (bytes->path (if (eq? (system-type) 'windows) s)])
(regexp-replace* #rx#"\"" s #"") (if (bytes=? s #"")
s)) (append default l)
l))))) (cons (bytes->path s)
l))))))
(lambda (s default) (lambda (s default)
(unless (or (bytes? s) (unless (or (bytes? s)
(string? s)) (string? s))