Mojo function
expanduser
expanduser[PathLike: PathLike, //](path: PathLike) -> String
Expands a tilde "~" prefix in path
to the user's home directory.
For example, ~/folder
becomes /home/current_user/folder
. On macOS and
Linux a path starting with ~user/
will expand to the specified user's home
directory, so ~user/folder
becomes /home/user/folder
.
If the home directory cannot be determined, or the path
is not prefixed
with "~", the original path is returned unchanged.
Parameters:
- PathLike (
PathLike
): The type conforming to the os.PathLike trait.
Args:
- path (
PathLike
): The path that is being expanded.
Returns:
The expanded path.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!