10 releases

new 0.0.10 Apr 19, 2025
0.0.9 Apr 16, 2025
0.0.4 Mar 25, 2025

#343 in Filesystem

Download history 286/week @ 2025-03-21 152/week @ 2025-03-28 366/week @ 2025-04-04 147/week @ 2025-04-11

951 downloads per month

Unlicense OR CC0-1.0

46KB
1K SLoC

Normalize file paths

Version License MSRV Safe Rust dependency status Documentation Downloads

Normalize file system path

This rust library have several functions:

  1. Test if path is an absolute
  2. Normalize path
  3. Join paths
  4. Canonicalize path

Independant clean room implementation with testcases and support for both windows and unix path styles.

You can request normalization style you want at any platform by activating features posix and windows. If you activate feature posix then posix style normalization will be always available under name normalize_posix.

Normalization rules

  1. Trailing slash indicating a directory is preserved. This is different from Python where tailing slash is removed.
  2. If path is not absolute, normalized form can go to upper directory. This is similar to Python and JavaScript.
  3. Drive letters are normalized to upper case
  4. UNC server and share are normalized to lower case

License

This is free and unencumbered software released into the public domain.

This code can be used under terms of CC0 or the Unlicense.

Unlicense logo

No runtime deps