Re: Test if a file is local or via file sharing?
Re: Test if a file is local or via file sharing?
- Subject: Re: Test if a file is local or via file sharing?
- From: "John C. Daub" <email@hidden>
- Date: Mon, 08 Mar 2004 09:37:39 -0600
on 3/6/04 4:05 PM, email@hidden at
email@hidden wrote:
>
I've bumped into something I expected to be easy, and it's proving to be hard.
>
>
Given an NSString with a path to a file, I need to know if this file is on a
>
local disk or on a disk that's mounted via file sharing.
>
>
I expected [NSWorkspace mountedLocalVolumePaths] to help, but it also returns
>
the filesharing-mounted volumes as though they were local. Using Carbon, I've
>
been exploring the fsref, fsspec, volumeinfo, and so on, of the file, but I
>
haven't yet found anything that answers this question. I'm thinking maybe the
>
FileSystemID somehow encodes, or leads to, information that would help. But I
>
can't find any info to dig deeper into that.
>
>
Any suggestions on an approach to this problem?
Using a Carbon File Manager approach....
Take the path and convert it to an FSSpec or FSRef so you can get the
FSVolumeRefNum (vRefNum) and hence know what volume the file is on. Once you
know that you can use routines from MoreFiles like HGetVolParms()
(ultimately calls PBHGetVolParmsSync()), then checking if isNetworkVolume()
(a MoreFiles routine that checks if the GetVolParmsInfoBuffer::vMServerAdr
!= 0).
MoreFiles is available on Apple's developer web site.
If the volume is local, the file is too. If the volume is remote, the file
is too.
--
John C. Daub }:-)>=
<
mailto:email@hidden> <
http://www.hsoi.com/>
"There was supposed to be an earth-shattering kaboom!" - Marvin
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.