Adjust the web download phase of the install .plt file
menu item in drracket so that it first checks to see if the downloaded file matches a .plt archive and, if not, try to put some friendlier message in front of the gzip error closes PR 9425 closes PR 13129
This commit is contained in:
parent
008d1f7f1b
commit
ec6408b343
|
@ -10,7 +10,8 @@
|
||||||
net/head
|
net/head
|
||||||
setup/plt-installer
|
setup/plt-installer
|
||||||
help/bug-report
|
help/bug-report
|
||||||
racket/file)
|
racket/file
|
||||||
|
setup/unpack)
|
||||||
|
|
||||||
(import [prefix drracket:unit: drracket:unit^]
|
(import [prefix drracket:unit: drracket:unit^]
|
||||||
[prefix drracket:app: drracket:app^]
|
[prefix drracket:app: drracket:app^]
|
||||||
|
@ -473,13 +474,6 @@
|
||||||
;; install-plt-from-url : string (union #f dialog%) -> void
|
;; install-plt-from-url : string (union #f dialog%) -> void
|
||||||
;; downloads and installs a .plt file from the given url
|
;; downloads and installs a .plt file from the given url
|
||||||
(define (install-plt-from-url s-url parent)
|
(define (install-plt-from-url s-url parent)
|
||||||
(with-handlers ([(λ (x) #f)
|
|
||||||
(λ (exn)
|
|
||||||
(message-box (string-constant drscheme)
|
|
||||||
(if (exn? exn)
|
|
||||||
(format "~a" (exn-message exn))
|
|
||||||
(format "~s" exn))
|
|
||||||
#:dialog-mixin frame:focus-table-mixin))])
|
|
||||||
(define-values (port size)
|
(define-values (port size)
|
||||||
(let-values ([(port header)
|
(let-values ([(port header)
|
||||||
(get-pure-port/headers (string->url s-url)
|
(get-pure-port/headers (string->url s-url)
|
||||||
|
@ -537,10 +531,29 @@
|
||||||
(queue-callback (λ () (semaphore-post wait-to-start)))
|
(queue-callback (λ () (semaphore-post wait-to-start)))
|
||||||
(send d show #t)
|
(send d show #t)
|
||||||
(when exn (raise exn))
|
(when exn (raise exn))
|
||||||
|
(define unpack-err (open-output-string))
|
||||||
|
(cond
|
||||||
|
[(with-handlers ((exn:fail? values))
|
||||||
|
(parameterize ([error-display-handler drracket:init:original-error-display-handler]
|
||||||
|
[current-error-port unpack-err])
|
||||||
|
(fold-plt-archive tmp-filename void void void void void))
|
||||||
|
#f)
|
||||||
|
=>
|
||||||
|
(λ (exn)
|
||||||
|
(delete-file tmp-filename)
|
||||||
|
(message-box (string-constant drscheme)
|
||||||
|
(string-append
|
||||||
|
(string-constant install-plt-error-header)
|
||||||
|
"\n\n"
|
||||||
|
(exn-message exn)
|
||||||
|
"\n\n"
|
||||||
|
(get-output-string unpack-err))
|
||||||
|
#:dialog-mixin frame:focus-table-mixin))]
|
||||||
|
[else
|
||||||
(parameterize ([error-display-handler drracket:init:original-error-display-handler])
|
(parameterize ([error-display-handler drracket:init:original-error-display-handler])
|
||||||
(run-installer tmp-filename
|
(run-installer tmp-filename
|
||||||
(λ ()
|
(λ ()
|
||||||
(delete-file tmp-filename)))))))
|
(delete-file tmp-filename))))])))
|
||||||
|
|
||||||
(define keybindings-frame%
|
(define keybindings-frame%
|
||||||
(class frame%
|
(class frame%
|
||||||
|
|
|
@ -440,6 +440,7 @@ please adhere to these guidelines:
|
||||||
(install-plt-file-tab "File")
|
(install-plt-file-tab "File")
|
||||||
(install-plt-filename "Filename:")
|
(install-plt-filename "Filename:")
|
||||||
(install-plt-url "URL:")
|
(install-plt-url "URL:")
|
||||||
|
(install-plt-error-header "There was an error when checking the validity of the downloaded .plt file. Please check the url and try again.")
|
||||||
|
|
||||||
;; install plt file when opened in drscheme strings
|
;; install plt file when opened in drscheme strings
|
||||||
(install-plt-file "Install ~a or open for editing?")
|
(install-plt-file "Install ~a or open for editing?")
|
||||||
|
|
Loading…
Reference in New Issue
Block a user