Mac OS X .pkg installer: check for target folder before installing
If the target folder exists, let the user know and give up. (This seems safer than trying to delete the folder, since there might be other files in the folder than the original files, and the installer doesn't currently keep a list of installed files.)
This commit is contained in:
parent
17cafe652e
commit
2e327d7886
|
@ -22,9 +22,9 @@
|
|||
|
||||
(define (gen-install-script install-dest)
|
||||
(~a "#!/bin/sh\n"
|
||||
"echo \"" (regexp-replace* #rx"\""
|
||||
"echo \"" (regexp-replace* #rx"[\"$]"
|
||||
install-dest
|
||||
"\"'\"'\"")
|
||||
"\"'\\0'\"")
|
||||
"\"/bin > /etc/paths.d/racket\n"))
|
||||
|
||||
(define (make-pkg human-name src-dir pkg-name readme sign-identity)
|
||||
|
@ -106,6 +106,29 @@
|
|||
(attribute #f #f 'alignment "topleft")
|
||||
(attribute #f #f 'scaling "none"))
|
||||
null)
|
||||
(element #f #f
|
||||
'installation-check
|
||||
(list (attribute #f #f 'script "check_exists_already()"))
|
||||
null)
|
||||
(element #f #f
|
||||
'script
|
||||
null
|
||||
(list
|
||||
(cdata #f #f
|
||||
@~a{
|
||||
function check_exists_already () {
|
||||
if (system.files.fileExistsAtPath(@|(~s install-dest)|)) {
|
||||
my.result.type = "Fatal";
|
||||
my.result.title = "Folder Exists Already";
|
||||
my.result.message = ("Cannot install because a "
|
||||
+ @|(~s (~s human-name))|
|
||||
+ " folder"
|
||||
+ " already exists in the Applications folder."
|
||||
+ " Please remove it and try again.");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}})))
|
||||
(element-content e))]))]))
|
||||
(call-with-output-file*
|
||||
pkg-xml
|
||||
|
|
Loading…
Reference in New Issue
Block a user