Similar to
try_from_bstr()
, but
panics if malformed surrogates are encountered on windows.
Similar to
try_into_bstr()
but
panics if malformed surrogates are encountered on windows.
return true if path
is absolute, which depends on the platform but is always true if it starts with a slash
, hence looks like
a linux path.
Join path
to base
such that they are separated with a /
, i.e. base/path
.
Resolve relative components virtually without accessing the file system, e.g. turn a/./b/c/.././..
into a
,
without keeping intermediate ..
and /a/../b/..
becomes /
.
If the input path was relative and ends up being the current_dir
, .
is returned instead of the full path to current_dir
.
Note that single .
components as well as duplicate separators are left untouched.
Like
into_bstr()
, but takes
OsStr
as input for a lossless, but fallible, conversion.
Like
into_bstr()
, but takes
OsString
as input for a lossless, but fallible, conversion.
Check each component of path
and see if it is a symlink. If so, resolve it.
Do not fail for non-existing components, but assume these are as is.
The same as
realpath()
, but allow to configure
max_symlinks
to configure how many symbolic links we are going to follow.
This serves to avoid running into cycles or doing unreasonable amounts of work.
Rebuild the worktree-relative relative_path
to be relative to prefix
, which is the worktree-relative
path equivalent to the position of the user, or current working directory.
This is a no-op if prefix
is empty.
Convert paths with slashes to backslashes on windows and do nothing on unix, but panics if malformed surrogates are encountered on windows.
Assures the given bytes use the native path separator.
Replaces windows path separators with slashes, unconditionally.
Replaces windows path separators with slashes, but only do so on windows.
Find backslashes and replace them with slashes, which typically resembles a unix path, unconditionally.
Given input
bytes, produce a Path
from them ignoring encoding entirely if on unix.
Convert the given path either into its raw bytes on unix or its UTF8 encoded counterpart on windows.
Like
into_bstr()
, but takes
Cow<OsStr>
as input for a lossless, but fallible, conversion.