set the current-load-relative-directory to #f (initially) in drracket

This commit is contained in:
Robby Findler 2011-11-28 13:57:11 -06:00
parent 153dd73f6b
commit 25271be3e8
6 changed files with 16 additions and 24 deletions

View File

@ -90,8 +90,8 @@
#:use-use-current-security-guard? #t) #:use-use-current-security-guard? #t)
(log-info "expanding-place.rkt: 04 setting directories") (log-info "expanding-place.rkt: 04 setting directories")
(let ([init-dir (get-init-dir path)]) (let ([init-dir (get-init-dir path)])
(current-directory init-dir) (current-directory init-dir))
(current-load-relative-directory init-dir)) (current-load-relative-directory #f)
(define sp (open-input-string program-as-string)) (define sp (open-input-string program-as-string))
(port-count-lines! sp) (port-count-lines! sp)
(log-info "expanding-place.rkt: 05 installing security guard") (log-info "expanding-place.rkt: 05 installing security guard")

View File

@ -105,8 +105,7 @@ remain the same for tools that use them.
get-directory ;; (-> (union #f string[existing directory])) get-directory ;; (-> (union #f string[existing directory]))
;; returns the directory that should be the default for ;; returns the directory that should be the default for
;; the `current-directory' and `current-load-relative-directory' ;; the `current-directory' parameter in the repl.
;; parameters in the repl.
)) ))
(define unit:tab<%> (define unit:tab<%>

View File

@ -876,7 +876,7 @@
p)))) p))))
(current-output-port (swallow-specials original-output-port)) (current-output-port (swallow-specials original-output-port))
(current-error-port (swallow-specials original-error-port)) (current-error-port (swallow-specials original-error-port))
(current-load-relative-directory init-dir) (current-load-relative-directory #f)
(current-directory init-dir) (current-directory init-dir)
(error-display-handler (λ (str exn) (set! error-str str))) (error-display-handler (λ (str exn) (set! error-str str)))
@ -1041,7 +1041,9 @@
(build-module-filename (build-module-filename
(if (regexp-match #rx"^," name) (if (regexp-match #rx"^," name)
(substring name 1 (string-length name)) (substring name 1 (string-length name))
(build-path (current-load-relative-directory) name)))]) (build-path (or (current-load-relative-directory)
(current-directory))
name)))])
(add-module-code-connections base module-code)))) (add-module-code-connections base module-code))))
module-codes))) module-codes)))

View File

@ -1867,6 +1867,7 @@ If the namespace does not, they are colored the unbound color.
(λ () ; =user= (λ () ; =user=
(send the-tab set-breakables (current-thread) (current-custodian)) (send the-tab set-breakables (current-thread) (current-custodian))
(set-directory definitions-text) (set-directory definitions-text)
(current-load-relative-directory #f)
(current-error-port error-port) (current-error-port error-port)
(current-output-port output-port) (current-output-port output-port)
(error-display-handler (error-display-handler
@ -2016,14 +2017,12 @@ If the namespace does not, they are colored the unbound color.
;; set-directory : text -> void ;; set-directory : text -> void
;; sets the current-directory and current-load-relative-directory ;; sets the current-directory based on the file saved in the definitions-text
;; based on the file saved in the definitions-text
(define/private (set-directory definitions-text) (define/private (set-directory definitions-text)
(define tmp-b (box #f)) (define tmp-b (box #f))
(define fn (send definitions-text get-filename tmp-b)) (define fn (send definitions-text get-filename tmp-b))
(define dir (get-init-dir (and (not (unbox tmp-b)) fn))) (define dir (get-init-dir (and (not (unbox tmp-b)) fn)))
(current-directory dir) (current-directory dir))
(current-load-relative-directory dir))
;; with-lock/edit-sequence : text (-> void) -> void ;; with-lock/edit-sequence : text (-> void) -> void
;; sets and restores some state of the definitions text ;; sets and restores some state of the definitions text

View File

@ -3365,16 +3365,6 @@ module browser threading seems wrong.
(send module-browser-name-length-choice enable #t) (send module-browser-name-length-choice enable #t)
(close-status-line 'plt:module-browser)))) (close-status-line 'plt:module-browser))))
;; set-directory : text -> void
;; sets the current-directory and current-load-relative-directory
;; based on the file saved in the definitions-text
(define/private (set-directory definitions-text)
(define tmp-b (box #f))
(define fn (send definitions-text get-filename tmp-b))
(define dir (get-init-dir (and (not (unbox tmp-b)) fn)))
(current-directory dir)
(current-load-relative-directory dir))
; ;
; ;

View File

@ -2,10 +2,12 @@
Version 5.2.1 Version 5.2.1
------------------------------ ------------------------------
. The initial current-directory and current-load-relative-directory . The initial current-directory for unsaved programs in DrRacket is
for unsaved programs in DrRacket is now the user's home directory, now the user's home directory, instead of whatever the
instead of whatever the current-directory was for the underlying current-directory was for the underlying OS process.
OS process.
. The current-load-relative-directory is now set to #f initially in
DrRacket (to better match what Racket does).
. DrRacket no longer shows a stacktrace for syntax errors in the REPL. . DrRacket no longer shows a stacktrace for syntax errors in the REPL.