Crawler v0.3.0 Crawler.Linker.PathExpander
Expands the path by expanding any .
and ..
characters.
See https://github.com/elixir-lang/elixir/pull/6486
Link to this section Summary
Functions
Expands the path by expanding any .
and ..
characters
Link to this section Functions
Link to this function
expand_dot(path)
Expands the path by expanding any .
and ..
characters.
Note this function only expands any .
and ..
characters within the given
path, and it does not take into account the absolute or relative nature of
the path itself, for that please use expand/1
or expand/2
.
Examples
### Intended use case
iex> PathExpander.expand_dot("foo/bar/../baz")
"foo/baz"
iex> PathExpander.expand_dot("/foo/bar/../baz")
"/foo/baz"
### Non-intended use cases are ignored
iex> PathExpander.expand_dot("foo/bar/./baz")
"foo/bar/baz"
iex> PathExpander.expand_dot("../foo/bar")
"foo/bar"