views:

643

answers:

4

Is there a way to mount a folder on the hard disk as a device in Finder. The intend here is to provide the user with an easy way to get to a folder that my application uses to store data. I don't want my user to go searching for data in Application Data. I would rather allow them to make this data available as a mounted volume or device in Finder. I would also like this volume or device to be read/write, so that if the user makes any changes to the data files, the changes will get reflected in the original folder.

Is there a way to do this in cocoa, carbon or applescript.

+3  A: 

Try looking into FUSE. You can have all sorts of psuedo filesystems with that.

But I'd caution a little against what you are trying to do. It may make more sense to just have a button that opens the folder in your application, rather than create a new device. I personally would find it hard to continue to use an application that does such a thing. It doesn't really fit with the rest of the available applications.

You could also use an alias to point to your Application Data directory.

Matthew Schinckel
A: 

I would also urge caution with this, seems potentially somewhat confusing to most users. That said, have you considered simply creating a softlink to the directory in question?

Mike Abdullah
+1  A: 

You can use sparse disk image to create "fake" drive.

But why not make data directory configurable in your application? Or use subdirectory in ~/Documents/?

Alias/symlink on desktop will be the easiest solution:

ln -s '~/Application Data/Yourapp' '~/Desktop/Yourapp Data'
porneL
+1  A: 

Can I suggest rethinking this entirely? A symlink or alias would work, but, if possible, a better idea would be to register for the filetypes people will be moving into that folder, and then respond to opening them by moving or copying them to the correct folder. I'm thinking of something like the Dashboard interface, where if you double-click a downloaded .wdgt file, it asks if you want to 'install' the widget and then, if you do, copies it into ~/Library/Widgets. Obviously, if you're dealing with common types like images, folders, or generic text files, this might be impractical.

For implementation, you'd just add the document types to your Info.plist, and handle them in you App Delegate's -application:openFile: method.

Boaz Stuller