OxL Справочник OxL
РусскийEnglish

method fs.realpath

Absolute path with symbolic links and ./.. resolved; the path must exist.

Example:

oxl✓ проверяется в CI
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

Параметры

ИмяТип
pathstr

Возвращает

str

Ошибки

  • IoError @error
  • `IoError` (`NotFound` when the path does not exist).

Эффекты

io

Определено в: std/io/io.oxl:760

См. также