std::env

std::env

The process's view of its host.

exe_path

fn exe_path() -> string

Returns this executable's absolute path as UTF-8.

The path is '/'-separated on every host (Windows backslashes are converted) and has symlinks resolved where the OS resolves them (/proc/self/exe on Linux, realpath on macOS). It is a string, not a path type: the bytes are exactly what the OS reported.

Returns

the absolute path, or "" when the OS cannot say

Example

import std::io
import std::env

fn main() -> i32 {
    io::println(env::exe_path())
    return 0
}

Generated from Kairo source, Apache-2.0 WITH AdditionRef-Kairo-Runtime-exception.