A helper class providing runtime information about the current environment.
Parent Class
| Type | Name | Signature |
|---|---|---|
| field S C | lineSeparator | public static const String lineSeparator |
| field S C | pathSeparator | public static const String pathSeparator |
| field S C | separator | public static const String separator |
| method S | evaluate | public static var evaluate(System.EvalConfig, string, string[]) |
| method S | getAllEnv | public static Map getAllEnv() |
| method S | getEnv | public static String getEnv(string) |
| method S | getScript | public static Script getScript() |
public static const String lineSeparatorThe line separator. "\r\n" on Microsoft Windows; "\n" on Unix, Linux, macOS and other Unix-like systems.
public static const String pathSeparatorThe separator required by the operating system to enumerate multiple paths. This string always contains a single character: ";" on Microsoft Windows; ":" on Unix, Linux, macOS and other Unix-like systems.
public static const String separatorThe separator used by the file system to represent a path. This string always contains a single character: "\" on Microsoft Windows; "/" on Unix, Linux, macOS and other Unix-like systems.
public static var evaluate(EvalConfig config, string scriptPath, string[] arguments)Evaluate the given script with customized configuration.
The script must be a module-less script, otherwise this method will throw System.IllegalStateException.
This method can only be called from a module-less script and outside any form of functions, including lambdas. It can indeed be called from inside a nested scope, although any variables defined anywhere other than in the outermost scope won't be visible to the evaluated script.
Consequentially, this method can only be called from the main thread, as there is no way to start a thread that executes some random lines from the global script.
This method provides the finest control over the behavior of dynamic script interpretation. For most scenarios, consider using the two shortcut global functions instead: incl(string) and eval(string, string[]).
Required Policies
System.Environment/evalParameters
include statement.
arguments.Returns
null will be returned.Throws
public static Map getAllEnv()Get all environment vairables.
Required Policies
System.Environment/readReturns
public static String getEnv(string name)Get the value of environment vairable.
Required Policies
System.Environment/readParameters
Returns
Throws
name is null.public static Script getScript()Get the script which is running at the line where this method is called.
A method call can only happen at exactly one physical place. If that place is a script file, this method will return the script info for that file.
This method is supposed to be called in the same script of which the information is intended. Of the most importance, do not wrap this method in another method, as that would always return the script file which contains the wrapper method.
Required Policies
System.Environment/readReturns