Re: NSWorkspace File System Methods
Re: NSWorkspace File System Methods
- Subject: Re: NSWorkspace File System Methods
- From: Douglas Davidson <email@hidden>
- Date: Thu, 17 Jan 2002 10:02:00 -0800
On Thursday, January 17, 2002, at 09:28 AM, Joe Muscara wrote:
First, I'm calling
getFileSystemInfoForPath:isRemovable:isWritable:isUnmountable:description:
type: and according to the NSWorkspace documentation, *type* should
return an NSString that "indicates the file system type; values could
be "HFS," "UFS," or other values." But for both this value and the
NSString returned by description, all I get is "nil" (the 'value' shown
in the PB Debug pane becomes 0x0 after the call). The three BOOLs
return expected values.
I declare the NSStrings thusly
NSString *description;
NSString *fileSystemType;
and then call the method above like this (other declarations left out
for clarity)
[workspace getFileSystemInfoForPath:diskPath
isRemovable:&removableFlag
isWritable:&writableFlag
isUnmountable:&unmountableFlag
description:&description
type:&fileSystemType];
Any suggestions to what I might be doing wrong, or is there some bug?
This is a bug; on the other hand, filesystem types are complicated
enough now that a simple string like this is not so useful. The Carbon
files APIs have extensive means for querying filesystem attributes, and
there are also BSD-level APIs.
My second question is that I want my app to update when there's a
change to the file system (disk mount/unmount, etc.). I would think
that the right method to use would be fileSystemChanged, but damned if
I can figure out how. I mean, where do I put it in my app? If it were a
delegate method, I'd know, but maybe I've been doing those too long
lately. Sorry if this is a "duh."
Register with NSWorkspace's notification center for the "did mount" and
"did unmount" notifications.
Douglas Davidson