Francesco wrote:
> that I cannot use absolute paths because I don't know where the end
> user will end up putting this program (most likely it will be
> distributed on a CD-ROM).
Use NSBundle's +mainBundle method, which returns an instance that
corresponds to the .app bundle. Then use one of NSBundle's many -pathFor...
object methods to obtain the full path to the resource you need within that
bundle.
The advantage of using NSBundle methods is that you'll be able to find files
that are within the .app bundle, regardless of where the .app bundle is
located on disk.
> The question is now: what is "." when I run the .app file?
It's "/" when you run it from Finder or use the "open" command from
Terminal, and the build directory when you run it from PB/Xcode.
> Is there a way on a mac to use an absolute path to the cd-rom drive?
Assuming it's mounted, and the volume name is "MyCD":
/Volumes/MyCD/
If you're using Cocoa (I believe you mentioned that), you can also register
to receive one or more interesting notifications fired by NSWorkspace:
NSWorkspaceDidMountNotification, NSWorkspaceDidMountNotification, or
NSWorkspaceWillUnmountNotification. Each of these includes the path of the
volume that (will be|was) (mounted|unmounted).
sherm--<!-- ~MESSAGE_AFTER~ -->
>> Stay informed about: java app