PDA

View Full Version : Detecting network path




ithil
Jul 6, 2006, 12:47 AM
Hi all,

Is there any way to detect whether a selected path is on local disk or network path? Or is there any equivalent for Windows API 'PathIsUNC' which detects whether the selected path is network path or not.

Thanks.



slooksterPSV
Jul 7, 2006, 03:59 PM
COMMENT REMOVED - mrichmon gave the perfect way to do it.

mrichmon
Jul 8, 2006, 12:13 AM
Under OS X, if you log into a server for your home directory, then you cross over into the network via /private/server_name/users_folder ...
so you could enumerate the path to the Home Directory and test to see if /private is one of those paths, if it is, then you know that the user's home directory is on a network volume. Also your other connected volumjes digg deep into private. You'll have to view it yourself and figure it out.


/private has no bearing on whether a directory is on a local filesystem or on a remote filesystem. AFP mounted shares for example have no record under /private unless you specifically change the automounter default mount location.

The original poster should look at the XCode Reference library, specifically, Cocoa->File Management->Low-Level File Management Programming Topics. This document has a section "Locating Directories on the System" which discusses the NSSearchPathForDirectoriesInDomains class. I believe that this class will allow you to identify local and remote directories using "Local" and "Network" domains as a mask when obtaining the directory objects.

slooksterPSV
Jul 8, 2006, 12:20 AM
/private has no bearing on whether a directory is on a local filesystem or on a remote filesystem. AFP mounted shares for example have no record under /private unless you specifically change the automounter default mount location.

The original poster should look at the XCode Reference library, specifically, Cocoa->File Management->Low-Level File Management Programming Topics. This document has a section "Locating Directories on the System" which discusses the NSSearchPathForDirectoriesInDomains class. I believe that this class will allow you to identify local and remote directories using "Local" and "Network" domains as a mask when obtaining the directory objects.
That's good to know - that was the only way I knew how to test for it because I knew everything routed through /private on the macs at my school to connect to the AFP shares.
Also I just barely read about something like that, the NSSearchPathForDirectoriesInDomains so I had just barely read that section a while after I made that post. Thanx for the info.