Module git_repository::path
source · [−]Expand description
Modules
Structs
A dummy type to represent path specs and help finding all spots that take path specs once it is implemented. A preliminary version of a path-spec based on glances of the code.
The error type returned by into_bstr()
and others may suffer from failed conversions from or to bytes.
Functions
Resolve relative components virtually without accessing the file system, e.g. turn a/./b/c/.././..
into a
,
without keeping intermediate ..
and /a/../b/..
becomes /
.
Note that we might access the current_dir
if we run out of path components to pop off. If unset, we continue
which might lead to an invalid/uninteded path.
Similar to try_from_bstr()
, but panics if malformed surrogates are encountered on windows.
Similar to try_from_bstring()
, but will panic if there is ill-formed UTF-8 in the input
.
Similar to try_from_byte_slice()
, but will panic if there is ill-formed UTF-8 in the input
.
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.
Like into_bstr()
, but takes OsStr
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.
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.
Similar to from_byte_slice()
, but takes either borrowed or owned input
.
Similar to try_from_bstr()
, but takes and produces owned data.
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.