Leston Drake wrote:
>
> > Leston, why do you need to know where the app was installed?
> > Applications should be path-independent: the user should be able to
> > rename not only the disk it is on, but the folders and even the
> > application itself without breaking anything. This isn't Windows you
> > know! Not only *can* users rename folders and disks, but they
> > *expect* to.
>
> You raise a good question.
> We are designing an application that manages and launches multiple
> educational-type "lessons". There will eventually be hundreds of
> lessons available for purchase/download from a website. Initially a
> user will install the manager and a few lessons. Each time a new
> lesson is downloaded, it will need to be installed into a
> sub-directory of the manager, so that it can be launched.
Hmmm. Tricky.
A lot depends on the internal working of your application. Do the
lessons *really* have to be in a sub-directory? Maybe you can modify the
program logic to accept lessons in *any* directory?
Of course, that probably means you need to register a file type with
Apple, but you'll be registering the application's creator type with
Apple anyway, right? :-)
Just a question: when the user's download the lessons from the Web, how
do you guarantee they put them in the right directory without renaming
the file?
> That's the context. The best solution that I've come up with at this
> point is to store off the location of the manager when it is
> installed. As you point out, this fails if the user moves or renames
> the manager directory. Is there a better way to do this?
If you use relative paths, you can find subfolders even if the user
renames or moves the parent. If you need to find a subfolder "Lesson
Data" you should be able to use something like "./Lesson Data/" instead
of "My Hard Disk/Bunch of applications/School stuff/LetterPress
Software/Lesson Data/" (or whatever weird and tortured folder names the
user chooses to use, and believe me, I've seen some bizarre examples!).
--
Steven D'Aprano
==========================================
M.B. Sales Pty Ltd Ph: +61 3 9460-5244
A.C.N. 005-964-796 Fax: +61 3 9462-1161
Archives: http://www.mail-archive.com/metacard%40lists.best.com/
Info: http://www.xworlds.com/metacard/mailinglist.htm
Please send bug reports to <[EMAIL PROTECTED]>, not this list.