O'Reilly logo

Cocoa in a Nutshell by James Duncan Davidson, Michael Beam

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required