Environment - Kirix Documentation

Developer Resources

Environment

Overview

The Environment class allows the application to access information about the computer and the application's execution environment. Some examples of this are environment variables and standard paths.

Methods

Environment.getDirectorySeparator
Returns the computer's directory path separator
Environment.getDocumentsPath
Returns the user's document path
Environment.getEnvironmentVariable
Returns the value of a system environment variable
Environment.getProgramFilesPath
Returns the computer's program files path
Environment.getSystemPath
Returns the computer's system path
Environment.getTempPath
Returns the system's temporary path

Example

var output = "";

output += "Document Path: \t";
output += Environment.getDocumentsPath();
output += "\n";

output += "System Path: \t";
output += Environment.getSystemPath();
output += "\n";

output += "Temporary Path: \t";
output += Environment.getTempPath();
output += "\n\n";

alert(output);

Environment.getDirectorySeparator

static function Environment.getDirectorySeparator() : String

Description

Returns the computer's standard directory separator. On Windows systems, this is a backslash ("\"), on Linux systems it is a forward slash ("/")

Environment.getDocumentsPath

static function Environment.getDocumentsPath() : String

Description

Returns the user's document path. On Windows systems, this is the usually the user's My Documents directory

Environment.getEnvironmentVariable

static function Environment.getEnvironmentVariable(var_name : String) : String

Arguments

var_name
The name of the environment variable

Returns

The value of the environment variable. If the requested environment variable does not exist, an empty string is returned

Description

Calling getEnvironmentVariable() returns the value stored in the system environment variable specified by the var_name parameter. If the environment variable does not exist, an empty string is returned

Environment.getProgramFilesPath

static function Environment.getProgramFilesPath() : String

Description

Returns the computer's program files path. On Windows, this yields either the 'Program Files' path. On Linux systems, the /opt path is returned

Environment.getSystemPath

static function Environment.getSystemPath() : String

Description

Returns the computer's system path. On Windows, this yields either the 'System' or the 'System32' path, depending on the computer's configuration. On Linux systems, this is /usr/bin

Environment.getTempPath

static function Environment.getTempPath() : String

Description

Returns the system's temporary path.