"Move to Applications Folder?" Dev on how he simplified Mac app installation
potionfactory.com
potionfactory.com
But because they see the program as "running" from inside the image, they might try to launch the program again from within the .dmg after it had already been copied (if they didn't choose the Trash Image option.) Thus, the program should probably check for a copy of itself in /Applications and exec(3) it if it exists and is the same version, to avoid the lag of re-installing on every start. Though, since you want to kindly escort the users away from the .dmg, it might be better to present another dialog with the options "Run from /Applications" and "Copy Again" (to overwrite the old app—in case of a bad install or somesuch), giving them a small speedbump and a hint about where to find their app. The we-already-did-this dialog could even offer to automatically add an alias of the app to the Desktop or the Dock, "so you won't have to see this again."
why not move itself to Applications folder? You'd probably not find it without looking for it. The desktop is nice and visible.
most of the good ones have a "drag to applications folder" shortcut inside of them inside anyways so I don't see the problem with that particular convention.
You download a file that is a image of a disk, you have to mount that file, you have to drag the contained app to wherever you put your apps and then unmount the disk image. Can’t you see the craziness of this approach?
On a Mac your app is a single file (it isn’t, but behaves that way) you can drag anywhere and if you don’t like it anymore you trash it. Delivering your app with a .dmg breaks this simple model. Suddenly this app you see sitting there must be first dragged somewhere before you can use it (and you don‘t even get a warning if you don’t). And you have to handle a completely virtual disk image as if it were some real disk. Crazy.
Zip, however, seems to become a sort of standard wrapper for those kinds of bundles. iWork’09 files are just zipped bundles so that you can easily send them via email and nothing breaks if you do.
I notice that the code contains the use of 'goto' to handle an error condition. Seems clean.
Being somewhat of a intermediate programmer I've always read to stay away from 'goto'. Anyone care to comment on the use of it in Objective-C?
This is one of the few uses of goto which I find acceptable, and it's only necessary because these languages lack exceptions. Using goto for normal control flow, or even complex error handling, can be quite the nightmare. Particularly bi-directional gotos.
Given the situation though, that it seems he's avoiding exceptions out of habit or performance concern, I'd still use an exception in this case, rather than the goto, to protect myself from probable misuse and unpredictability.
[1] according to this http://stackoverflow.com/questions/324284/how-to-throw-an-ex..., objective-c has exceptions, but they're resource intensive and should be avoided.
Don't see whey we can't write a project that solves this problem on a general level with a similar method. When a .app appears in specified folders ask to move it to an applications folder. Watched folders default to ~/Desktop and ~/Downloads and the app folder defaults to /Applications.