-
Yorick Peterse authored
The module std::env can be used for obtaining and setting environment variables, the home directory, the temporary directory, and more. For example, one can obtain environment variable values as follows: import std::env env['HOME'] # => '/home/yorickpeterse' You can also set the value of a variable: import std::env env['HOME'] = '/home/foo' Removing variables is also possible: import std::env env.remove('HOME') # => Nil Or obtain the home directory: import std::env env.home_directory # => '/home/yorickpeterse' You can also obtain and set the working directory: import std::env try! env.working_directory # => '/home/yorickpeterse' try! env.working_directory = '/tmp' # => '/tmp' Arguments can be retrieved using `std::env.arguments`: import std::env env.arguments # => ['foo', 'bar'] == Executable changes The "inko" executable has been modified to pass additional commandline arguments to IVM. IVM in turn has been modified to expose these to the VM instructions. This requires us to explicitly store the passed arguments in a vm::state::State, as Rust's std::env::args() is immutable _and_ includes _all_ arguments (the bytecode file to execute, IVM options, etc). The arguments passed via the CLI are all interned, removing the need for allocating (potentially many) strings every time `std::env.arguments` is executed. Fixes #136