advertisement

Article:
  Easy Access to the Applications Folder from a Disk Image
Subject:   Installers vs. Packages
Date:   2005-09-03 12:59:37
From:   innerbat
I see a number of people proposing, essentially, that the app should use an installer instead of a drag-and-drop installation. An Apple Script installer, a package, and self-install code all amount to using an installer.


I am not opposed to using installers, however, Apple does clearly state their preference:


"Because most applications for Mac OS X are built as self-contained application bundles (defined below), users can install them in most situations just by dragging the bundle to a folder for which they have write permission. This drag-and-drop type of installation is the preferred method for installing Mac OS X software."


(Quoting from http://developer.apple.com/documentation/DeveloperTools/Conceptual/SoftwareDistribution/Concepts/sd_guidelines.html .)


This article is written under the assumption that you are past the point of debating whether to use an installer or a disk image, and provides a suggestion for how to make the disk image easier to use.


Also, to specifically address the suggestion for a self-installer: this is not a bad idea, but it's also pretty tricky to get it right. There are several failures that need to be handled very carefully, most notably what happens if the user does not have the permission to install in Applications folder, what happens if the user is already running an older version of the application, and whether to allow the user to keep an older version of the application around. With a drag-install the Finder takes care of all of those cases by asking the user the appropriate questions ("You don't have the permissions to modify Applications, do you want to authenticate?", "The item cannot be replaced because it's busy", and "An item of this name already exists, do you want to replace it.") It's not impossible, but it's far from trivial, and if I ever do it I am sure I'll be writing about that too.


This is easier to accomplish for plugins such as widgets for a variety of reasons. For example, the difficult case of the plugin needed to be replaced while it's already running can be handled much more easily for NNW styles and widgets because the process of unloading a NNW style or a widget (in order to replace it with a new one) is very simple. Unloading an already running application is much more complicated, and it involves bringing the application to the foreground, cancelling pending tasks, prompting the user to review unsaved documents, etc.


Ben