NSWorkspace

NSWorkspace Mac OS X 10.0

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.

figs/cocn_15117.gif

@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:(NSArray *)fullPaths;
   - (BOOL)isFilePackageAtPath:(NSString *)fullPath;
   - (BOOL)launchApplication:(NSString *)appName;
   - (BOOL)launchApplication:(NSString *)appName showIcon:(BOOL)showIcon autolaunch:(BOOL)autolaunch;
   - (NSArray *)launchedApplications;
   - (NSArray *)mountNewRemovableMedia;
   - (NSArray *)mountedLocalVolumePaths;
   - (NSArray *)mountedRemovableMedia;
   - (void)noteFileSystemChanged;
   - (void)noteFileSystemChanged:(NSString *)path;
   - (void)noteUserDefaultsChanged;
   - (NSNotificationCenter *)notificationCenter;
   - (BOOL)openFile:(NSString *)fullPath;
   - (BOOL)openFile:(NSString *)fullPath fromImage:(NSImage *)anImage at:(NSPoint)point inView:(NSView *)aView;
   - (BOOL)openFile:(NSString *)fullPath withApplication:(NSString *)appName;
   - (BOOL)openFile:(NSString *)fullPath withApplication:(NSString *)appName andDeactivate:(BOOL)flag;
   - (BOOL)openTempFile:(NSString *)fullPath;
   - (BOOL)openURL:(NSURL *)url;
   - (BOOL)performFileOperation:(NSString *)operation source:(NSString *)source destination:(NSString *)destination
        files:(NSArray *)files tag:(int *)tag;
   - (BOOL)selectFile:(NSString *)fullPath inFileViewerRootedAtPath:(NSString *)rootFullpath;
   - (void)slideImage:(NSImage *)image from:(NSPoint)fromPoint to:(NSPoint)toPoint;
   - (BOOL)unmountAndEjectDeviceAtPath:(NSString *)path;
   - (BOOL)userDefaultsChanged;
// Notifications
   NSWorkspaceWillPowerOffNotification;



    Part II: API Quick Reference
    Chapter 13. Foundation Classes