method fs.realpath
Absolute path with symbolic links and ./.. resolved; the path must exist.
Example:
use std.io { fs }
fn main() io {
let dir = fs.tempDir("demo-")!
let sub = "{dir}/sub"
fs.createDir(sub)!
let p = fs.realpath("{sub}/../sub")!
let q = fs.realpath(sub)!
print("{p == q} {p.endsWith("/sub")}")
fs.removeAll(dir)!
}Вывод
true true
pub(api) static fn realpath(path: str) -> str | IoError ioС версии. 1.0.0-beta
Параметры
| Имя | Тип |
|---|---|
path | str |
Возвращает
str
Ошибки
IoError@error- `IoError` (`NotFound` when the path does not exist).
Эффекты
io
Определено в: std/io/io.oxl:760