Name

NSWorkspace — Mac OS X 10.0

Synopsis

This class makes available to Cocoa applications many of Mac OS X’s “workspace” services, which are essentially those services provided by the Finder. NSWorkspace provides methods for discovering characteristics of the workspace, such as what GUI applications are running and what volumes are mounted. Additionally, applications can use NSWorkspace to open files and URLs as if they were opened in the Finder. Each application has a single shared instance of NSWorkspace that is accessed with the method sharedWorkspace.

image with no caption

@interface NSWorkspace : NSObject
                                  // Class Methods
   + (NSWorkspace *)sharedWorkspace;
                                  // Instance Methods
   - (NSDictionary *)activeApplication;
   - (void)checkForRemovableMedia;
   - (int)extendPowerOffBy:(int)requested;
   - (BOOL)fileSystemChanged;
   - (void)findApplications;
   - (NSString *)fullPathForApplication:(NSString *)appName;
   - (BOOL)getFileSystemInfoForPath:(NSString *)fullPath 
                                 isRemovable:(BOOL *)removableFlag
                                 isWritable:(BOOL *)writableFlag 
                                 isUnmountable:(BOOL *)unmountableFlag 
                                 description:(NSString **)description
                                 type:(NSString **)fileSystemType;
   - (BOOL)getInfoForFile:(NSString *)fullPath 
                                 application:(NSString **)appName 
                                 type:(NSString **)type;
   - (void)hideOtherApplications;
   - (NSImage *)iconForFile:(NSString *)fullPath;
   - (NSImage *)iconForFileType:(NSString *)fileType;
   - (NSImage *)iconForFiles ...

Get Cocoa in a Nutshell now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.