API Reference › Path › Path.base
method

Path.base

Path.base(p) -> string

Returns the final component — the file or last directory name — after the last /. A path with no separator is returned unchanged. The complement of dir.

Parameters

pthe path

Example

program Base {
  entry {
    if Path.base("mods/foo/data.json") == "data.json" { print(1) }
  }
}
← All symbols