Crawler.Linker.PathExpander (Crawler v1.1.2) View Source

Expands the path by expanding any . and .. characters.

See this pull request.

Link to this section Summary

Functions

Expands the path by expanding any . and .. characters.

Link to this section Functions

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"