IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /docs/manual/basics.md). For the complete Mojo documentation index, see llms.txt.
Skip to main content
Version: Nightly
For the complete Mojo documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /docs/manual/basics.md).

realpath

def realpath[PathLike: ImplicitlyDeletable & PathLike, //](path: PathLike) -> String

Expands all symbolic links and resolves references to /./, /../ and extra '/' characters in the null-terminated string named by path to produce a canonicalized absolute pathname.The resulting path will have no symbolic link, /./ or /../ components.

Parameters:

Args:

  • path (PathLike): The path to resolve.

Returns:

String: A String of the resolved path. Raises:

  • Read or search permission was denied for a component of the path prefix.

  • path is NULL.

  • An I/O error occurred while reading from the filesystem.

  • Too many symbolic links were encountered in translating the pathname.

  • A component of a pathname exceeded NAME_MAX characters, or an entire pathname exceeded PATH_MAX characters.

  • The named file does not exist.

  • Out of memory.

  • A component of the path prefix is not a directory.