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; }

 

Shared Property ApplicationContext() As Object

CompilerMode

 

class property CompilerMode: CompilerMode read;

 

class CompilerMode CompilerMode { get; }

 

static var CompilerMode: CompilerMode { get{} }

 

class CompilerMode CompilerMode { __get; }

 

Shared ReadOnly Property CompilerMode() As CompilerMode

CompilerSubMode

 

class property CompilerSubMode: CompilerSubMode read;

 

class CompilerSubMode CompilerSubMode { get; }

 

static var CompilerSubMode: CompilerSubMode { get{} }

 

class CompilerSubMode CompilerSubMode { __get; }

 

Shared ReadOnly Property CompilerSubMode() As CompilerSubMode

CurrentDirectory

 

class method CurrentDirectory: String

 

static String CurrentDirectory()

 

static func CurrentDirectory() -> String

 

static String CurrentDirectory()

 

Shared Function CurrentDirectory() As String

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)

 

Shared Function GetEnvironmentVariable(Name As String) As String

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; }

 

Shared ReadOnly Property NewLine() As String

OS

 

class property OS: OperatingSystem read;

 

class OperatingSystem OS { get; }

 

static var OS: OperatingSystem { get{} }

 

class OperatingSystem OS { __get; }

 

Shared ReadOnly Property OS() As OperatingSystem

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; }

 

Shared ReadOnly Property OSName() As String

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; }

 

Shared ReadOnly Property OSVersion() As String

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; }

 

Shared ReadOnly Property TargetPlatform() As TargetPlatform

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; }

 

Shared ReadOnly Property TargetPlatformName() As String

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; }

 

Shared ReadOnly Property UserName() As String

 

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; }

 

Shared Property ApplicationContext() As Object

CompilerMode

 

class property CompilerMode: CompilerMode read;

 

class CompilerMode CompilerMode { get; }

 

static var CompilerMode: CompilerMode { get{} }

 

class CompilerMode CompilerMode { __get; }

 

Shared ReadOnly Property CompilerMode() As CompilerMode

CompilerSubMode

 

class property CompilerSubMode: CompilerSubMode read;

 

class CompilerSubMode CompilerSubMode { get; }

 

static var CompilerSubMode: CompilerSubMode { get{} }

 

class CompilerSubMode CompilerSubMode { __get; }

 

Shared ReadOnly Property CompilerSubMode() As CompilerSubMode

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; }

 

Shared ReadOnly Property NewLine() As String

OS

 

class property OS: OperatingSystem read;

 

class OperatingSystem OS { get; }

 

static var OS: OperatingSystem { get{} }

 

class OperatingSystem OS { __get; }

 

Shared ReadOnly Property OS() As OperatingSystem

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; }

 

Shared ReadOnly Property OSName() As String

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; }

 

Shared ReadOnly Property OSVersion() As String

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; }

 

Shared ReadOnly Property TargetPlatform() As TargetPlatform

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; }

 

Shared ReadOnly Property TargetPlatformName() As String

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; }

 

Shared ReadOnly Property UserName() As String

 

CurrentDirectory

 

class method CurrentDirectory: String

 

static String CurrentDirectory()

 

static func CurrentDirectory() -> String

 

static String CurrentDirectory()

 

Shared Function CurrentDirectory() As String

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)

 

Shared Function GetEnvironmentVariable(Name As String) As String

Parameters:

  • Name: The name of the environment variable.