Search results

There are no results.

std.env.working_directory

Show source code
Hide source code
fn pub working_directory -> Result[Path, Error] {
  match inko_env_get_working_directory(_INKO.state) {
    case { @tag = 0, @value = val } -> Result.Ok(Path.new(val as String))
    case { @tag = _, @value = err } -> {
      Result.Error(Error.from_os_error(err as Int))
    }
  }
}
fn pub static working_directory -> Result[Path, Error]

Returns the current working directory.

This method will return an Error if we failed to get the directory. Possible causes for this could be:

  1. The directory no longer exists.
  2. You do not have the permissions to access the directory.

Examples

Obtaining the current working directory:

import std.env

env.working_directory # => Result.Ok('/home/alice/example')