I'm working on a application that has an option to automatically store some user files wherever the user configures it to, including network shares, so that those could be shared between multiple users on the network. This works great on Windows when using a typical UNC path (//server/share/) but on Mac OS X (10.6 - 10.8) is all sorts of weird.
For one, if I connect to, for example smb://server/data, using Finder it will create a mount in Finder which is logically linked to /Volumes/data. So let's say that the user opens my app and browses to a sub folder in that mount and the system resolves the actual path that I store to being "/Volumes/data/shared_settings/" This is fine for the most part except a couple of things
- Sometimes, if that mount has timed out of it's connection and I browse back to it in Finder, it will show up again as a mount just fine. But upon closer inspection in the terminal, it's now mounted at /Volumes/data-1/ or /Volumes/data-2/. As you can imagine, this screws up the configured path in my app considerably. Is there a way to get it to always go to the same mount path?
- Also, on windows if you browse to a direct UNC path or a mounted share with a drive letter and that connection is not currently live, it will always try to reconnect. Even if you are browsing there from the terminal or programmatically in any app... it will at least try to reconnect first. In my experience, OS X does not even bother. I understand that this is really because of the nature of unix... my share is just mounted at /Volumes/data/ but that folder still exists even if the connection doesn't so my application tries to look in that folder and just sees that it's empty. But can you either force a reconnection or make sure the connection never dies?
Last caveat, this needs to be workable by the average user. Sure, I can call mount_smbfs at the command line all day, but users of my application would not be that savvy.