• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSWorkspace File System Methods
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSWorkspace File System Methods


  • Subject: Re: NSWorkspace File System Methods
  • From: Eric Peyton <email@hidden>
  • Date: Thu, 17 Jan 2002 11:49:22 -0600

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 for the two NSWorkspace notifications of disk mounts and unmount (you do not use the fileSystemChanged method - you are looking a that method incorrectly).

APPKIT_EXTERN NSString *NSWorkspaceDidMountNotification; // @"NSDevicePath"
APPKIT_EXTERN NSString *NSWorkspaceDidUnmountNotification; // @"NSDevicePath"
APPKIT_EXTERN NSString *NSWorkspaceWillUnmountNotification; // @"NSDevicePath"

(completely untested and unverified code snippet follows)

Register for notifications

[[[NSWorkspace sharedWorkspace] notificationCenter] addObserver:self selector:@selector(unmountHappened:) name: NSWorkspaceDidUnmountNotification object:nil];

And then implement your own notification method

- (void)unmountHappened:(NSNotification *)not
{
NSLog(@"hey look disk %@ unmounted", [[not userInfo] objectForKey:@"NSDevicePath"]);
return;
}


Eric


TIA,
Joe
_______________________________________________
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.


References: 
 >NSWorkspace File System Methods (From: Joe Muscara <email@hidden>)

  • Prev by Date: Re: Draggable NSImage of custom NSView ???
  • Next by Date: Re: NSWorkspace File System Methods
  • Previous by thread: NSWorkspace File System Methods
  • Next by thread: Re: NSWorkspace File System Methods
  • Index(es):
    • Date
    • Thread