Skip to main content

Mojo function

realpath

realpath[PathLike: 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:

  • PathLike (PathLike): The type conforming to the os.PathLike trait.

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.

Was this page helpful?