Environment

Overview

Provides information about the current environment and platform.

Use the Environment class to retrieve information such as environment variable or operating system version.

Note: this class is heavily related to a current platform, some of methods may not be available for all environments.

Location

  • Reference: Sugar
  • Namespace: Sugar

 

ApplicationContext

Android only. Global information about an application environment. This property is required for some classes (Folder, UserSettings) on the Anroid platform.

 

class property ApplicationContext: Object read write;

 

class Object ApplicationContext { get; set; }

 

static var ApplicationContext: Object { get{} set{} }

 

class Object ApplicationContext { __get; __set; }

CompilerMode

 

class property CompilerMode: CompilerMode read;

 

class CompilerMode CompilerMode { get; }

 

static var CompilerMode: CompilerMode { get{} }

 

class CompilerMode CompilerMode { __get; }

CompilerSubMode

 

class property CompilerSubMode: CompilerSubMode read;

 

class CompilerSubMode CompilerSubMode { get; }

 

static var CompilerSubMode: CompilerSubMode { get{} }

 

class CompilerSubMode CompilerSubMode { __get; }

CurrentDirectory

 

class method CurrentDirectory: String

 

static String CurrentDirectory()

 

static func CurrentDirectory() -> String

 

static String CurrentDirectory()

GetEnvironmentVariable

Retrieves the value of an environment variable from the current process.

 

class method GetEnvironmentVariable(Name: String): String

 

static String GetEnvironmentVariable(String Name)

 

static func GetEnvironmentVariable(_ Name: String) -> String

 

static String GetEnvironmentVariable(String Name)

Parameters:

  • Name: The name of the environment variable.

NewLine

Gets the newline string defined for this environment.

 

class property NewLine: String read;

 

class String NewLine { get; }

 

static var NewLine: String { get{} }

 

class String NewLine { __get; }

OS

 

class property OS: OperatingSystem read;

 

class OperatingSystem OS { get; }

 

static var OS: OperatingSystem { get{} }

 

class OperatingSystem OS { __get; }

OSName

Gets a string that contains the current platform name.

 

class property OSName: String read;

 

class String OSName { get; }

 

static var OSName: String { get{} }

 

class String OSName { __get; }

OSVersion

Gets a string that contains the current platform version number.

 

class property OSVersion: String read;

 

class String OSVersion { get; }

 

static var OSVersion: String { get{} }

 

class String OSVersion { __get; }

TargetPlatform

Gets a value that indicates active platfrom.

 

class property TargetPlatform: TargetPlatform read;

 

class TargetPlatform TargetPlatform { get; }

 

static var TargetPlatform: TargetPlatform { get{} }

 

class TargetPlatform TargetPlatform { __get; }

TargetPlatformName

Gets a string that contains current platform name.

 

class property TargetPlatformName: String read;

 

class String TargetPlatformName { get; }

 

static var TargetPlatformName: String { get{} }

 

class String TargetPlatformName { __get; }

UserName

Gets the user name of currently active or device owner user.

 

class property UserName: String read;

 

class String UserName { get; }

 

static var UserName: String { get{} }

 

class String UserName { __get; }

 

ApplicationContext

Android only. Global information about an application environment. This property is required for some classes (Folder, UserSettings) on the Anroid platform.

 

class property ApplicationContext: Object read write;

 

class Object ApplicationContext { get; set; }

 

static var ApplicationContext: Object { get{} set{} }

 

class Object ApplicationContext { __get; __set; }

CompilerMode

 

class property CompilerMode: CompilerMode read;

 

class CompilerMode CompilerMode { get; }

 

static var CompilerMode: CompilerMode { get{} }

 

class CompilerMode CompilerMode { __get; }

CompilerSubMode

 

class property CompilerSubMode: CompilerSubMode read;

 

class CompilerSubMode CompilerSubMode { get; }

 

static var CompilerSubMode: CompilerSubMode { get{} }

 

class CompilerSubMode CompilerSubMode { __get; }

NewLine

Gets the newline string defined for this environment.

 

class property NewLine: String read;

 

class String NewLine { get; }

 

static var NewLine: String { get{} }

 

class String NewLine { __get; }

OS

 

class property OS: OperatingSystem read;

 

class OperatingSystem OS { get; }

 

static var OS: OperatingSystem { get{} }

 

class OperatingSystem OS { __get; }

OSName

Gets a string that contains the current platform name.

 

class property OSName: String read;

 

class String OSName { get; }

 

static var OSName: String { get{} }

 

class String OSName { __get; }

OSVersion

Gets a string that contains the current platform version number.

 

class property OSVersion: String read;

 

class String OSVersion { get; }

 

static var OSVersion: String { get{} }

 

class String OSVersion { __get; }

TargetPlatform

Gets a value that indicates active platfrom.

 

class property TargetPlatform: TargetPlatform read;

 

class TargetPlatform TargetPlatform { get; }

 

static var TargetPlatform: TargetPlatform { get{} }

 

class TargetPlatform TargetPlatform { __get; }

TargetPlatformName

Gets a string that contains current platform name.

 

class property TargetPlatformName: String read;

 

class String TargetPlatformName { get; }

 

static var TargetPlatformName: String { get{} }

 

class String TargetPlatformName { __get; }

UserName

Gets the user name of currently active or device owner user.

 

class property UserName: String read;

 

class String UserName { get; }

 

static var UserName: String { get{} }

 

class String UserName { __get; }

 

CurrentDirectory

 

class method CurrentDirectory: String

 

static String CurrentDirectory()

 

static func CurrentDirectory() -> String

 

static String CurrentDirectory()

GetEnvironmentVariable

Retrieves the value of an environment variable from the current process.

 

class method GetEnvironmentVariable(Name: String): String

 

static String GetEnvironmentVariable(String Name)

 

static func GetEnvironmentVariable(_ Name: String) -> String

 

static String GetEnvironmentVariable(String Name)

Parameters:

  • Name: The name of the environment variable.