www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit 1521fd2b8ec6f42137e8ca8a56b91c927397639d
parent ad6ac7fe286abea3cac46c614f5243c33ba395a1
Author: Matthew Flatt <mflatt@racket-lang.org>
Date:   Fri, 24 Oct 2014 07:00:14 -0600

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.)

original commit: 2e327d78866c598430a83632a7dde215bbfd4397

Diffstat:
Mpkgs/distro-build-pkgs/distro-build-client/installer-pkg.rkt | 27+++++++++++++++++++++++++--
1 file changed, 25 insertions(+), 2 deletions(-)

diff --git a/pkgs/distro-build-pkgs/distro-build-client/installer-pkg.rkt b/pkgs/distro-build-pkgs/distro-build-client/installer-pkg.rkt @@ -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