webc

Function sanitize_path

Source
pub fn sanitize_path(path: impl AsRef<Path>) -> String
Expand description

Turn any path that gets passed in into something WASI can use.

In general, this means…

  • Use “/” everywhere
  • Remove “.” or “..” components
  • Make the path absolute because when loaded it’ll be absolute with respect to the volume
  • Get rid of any UNC path stuff