Skip to main content

normalize_lexical

Function normalize_lexical 

Source
pub fn normalize_lexical(path: impl AsRef<Path>) -> PathBuf
Expand description

Normalizes a path by removing lexical . and .. components.

This function does not touch the file system and does not resolve symbolic links.

§Arguments

  • path: Path to normalize.

§Returns

Returns path with lexical current-directory and parent-directory components simplified.

§Examples

use std::path::PathBuf;
use rust_config_tree::normalize_lexical;

let path = normalize_lexical("config/./server/../app.yaml");

assert_eq!(path, PathBuf::from("config/app.yaml"));