use "replace" instead of "delete" for executable creation when

the file already exists and improve error handling

closes PR 13243
This commit is contained in:
Robby Findler 2012-11-22 15:07:34 -06:00
parent b4b7340fd9
commit 25e92e2cc2
2 changed files with 27 additions and 12 deletions

View File

@ -32,6 +32,7 @@
(import [prefix drracket:debug: drracket:debug^]
[prefix drracket:tools: drracket:tools^]
[prefix drracket:rep: drracket:rep^]
[prefix drracket:init: drracket:init^]
[prefix drracket:help-desk: drracket:help-desk^])
(export drracket:language^)
@ -689,16 +690,28 @@
[(launcher) create-module-based-launcher]
[(stand-alone) create-module-based-stand-alone-executable]
[(distribution) create-module-based-distribution])])
(create-executable
program-filename
executable-filename
module-language-spec
transformer-module-language-spec
init-code
(if (boolean? mred-launcher)
mred-launcher
(eq? base 'mred))
use-copy?)))))
(with-handlers ((exn:fail? (λ (msg)
(define sp (open-output-string))
(parameterize ([current-error-port sp])
(drracket:init:original-error-display-handler
(exn-message exn)
exn))
(message-box
(string-constant drscheme)
(string-append
(string-constant error-creating-executable)
"\n\n"
(get-output-string sp))))))
(create-executable
program-filename
executable-filename
module-language-spec
transformer-module-language-spec
init-code
(if (boolean? mred-launcher)
mred-launcher
(eq? base 'mred))
use-copy?))))))
;; create-executable-gui : (union #f (is-a?/c top-level-area-container<%>))
@ -851,7 +864,7 @@
;; ask-user-can-clobber-directory? : (is-a?/c top-level-window<%>) string -> boolean
(define (ask-user-can-clobber? filename)
(eq? (message-box (string-constant drscheme)
(format (string-constant are-you-sure-delete?) filename)
(format (string-constant are-you-sure-replace?) filename)
dlg
'(yes-no)
#:dialog-mixin frame:focus-table-mixin)

View File

@ -120,6 +120,7 @@ please adhere to these guidelines:
(stop "Stop")
(&stop "&Stop") ;; for use in button and menu item labels, with short cut.
(are-you-sure-delete? "Are you sure you want to delete ~a?") ;; ~a is a filename or directory name
(are-you-sure-replace? "Are you sure you want to replace ~a?") ;; ~a is a filename or directory name
(ignore "Ignore")
(revert "Revert")
@ -995,7 +996,8 @@ please adhere to these guidelines:
(save-a-mzscheme-stand-alone-executable "Save a Racket Stand-alone Executable")
(save-a-mred-distribution "Save a GRacket Distribution")
(save-a-mzscheme-distribution "Save a Racket Distribution")
(error-creating-executable "Error creating executable:") ;; this is suffixed with an error message ala error-display-handler
(definitions-not-saved "The definitions window has not been saved. The executable will use the latest saved version of the definitions window. Continue?")
;; The "-explanatory-label" variants are the labels used for the radio buttons in
;; the "Create Executable..." dialog for the "(module ...)" language.