infinity.current¶
The following properties provide information about the current working files and directories.
Module: none (built-in)
dir¶
Type: string
Contains the directory part of the script file currently being executed, relative to root and with forward slashes (e.g. '' for main.js, 'services/' while executing a file included with infinity.include('services/system.js')). The value is updated while an included file is executed and restored afterwards.
file¶
Type: string
Contains the file name (without directory) of the script file currently being executed, e.g. 'main.js'. The value is updated while an included file is executed and restored afterwards.
root¶
Type: string
Gets the root directory of the program, i.e. the folder containing the main script file that INFINITY.JS has been started with. Paths passed to infinity.include() and to the infinity.thread constructor are resolved relative to this folder. The path uses forward slashes and ends with a slash.
run¶
Type: string
Gets the directory of the INFINITY.JS executable. The path uses forward slashes and ends with a slash.
temp¶
Type: string
Gets the directory for temporary files (the temp folder next to the folder of the INFINITY.JS executable, i.e. <run>/../temp/). The path uses forward slashes and ends with a slash.
Example:
console.info(infinity.current.root + 'config.ini');
console.info(infinity.current.dir + infinity.current.file);