Copyright ã1994 by NeXT Computer, Inc.  All Rights Reserved.

NSProcessInfo 

Inherits From:	NSObject

Conforms To:	NSObject (NSObject)

Declared In:	Foundation/NSProcessinfo.h

Class Description

The NSProcessInfo class provides methods to access process-wide information. An NSProcessInfo object can return such information as the arguments, environment, host name, or process name. The processInfo class method returns an NSProcessInfo object. For example, the following code creates an NSProcessInfo object, which then provides the name of the current process:

[[NSProcessInfo processInfo] processName];

Getting an NSProcessInfo Object

+ (NSProcessInfo *)processInfo	Returns the NSProcessInfo object for the process. It is already initialized. An NSProcessInfo object is created the first time this method is invoked, and that same object is returned on each subsequent invocation.

Returning Process Information

- (NSArray *)arguments	Returns the arguments as an array of NSStrings from the command line.

- (NSDictionary *)environment	Returns a dictionary of variables defined for the environment from which the process was launched.

- (NSString *)hostName	Returns the name of the host system.

- (NSString *)processName	Returns the name of the process under which this program's user defaults domain is created, and is the name used in error messages. It does not uniquely identify the process.

- (NSString *)globallyUniqueString	Returns a globally unique string to identify the process. This method uses the host name, process ID, and a timestamp to ensure that the string returned will be globally unique.

Specifying a Process Name

- (void)setProcessName:(NSString *)newName	Sets the name of the process to newName. Warning: Aspects of the environment like userDefaults might depend on the process name, so be very careful if you change this. Setting the process name this way is not thread-safe.