Skip to content

📂 Rust port of path normalization from MRI Ruby.

License

MIT, Unknown licenses found

Licenses found

MIT
LICENSE
Unknown
COPYING
Notifications You must be signed in to change notification settings

artichoke/ruby-file-expand-path

Repository files navigation

ruby-file-expand-path

GitHub Actions Discord Twitter
Crate API API trunk

Implements file path expansion and normalization routines from MRI Ruby.

A new function (normalize or make_absolute or something, bikeshed away) should be added that will turn a relative path into an absolute path without touching the filesystem. (rust-lang/rust#59117).

This crate normalizes and absolutizes paths according to the logic in Ruby v3.0.2 for POSIX and Win32.

Usage

Add this to your Cargo.toml:

[dependencies]
ruby-file-expand-path = "0.1.0"

Then normalize paths like:

assert_eq!(
    ruby_file_expand_path::expand("/home/artichoke/scripts/../run.sh"),
    Ok(b"/home/artichoke/run.sh")
);

License

ruby-file-expand-path is licensed under the MIT License (c) Ryan Lopopolo.

ruby-file-expand-path is derived from ruby @ v3.0.2. ruby is dual licensed under the Ruby License or 2-clause BSD License Copyright (c) Yukihiro Matsumoto <matz@netlab.jp>. A copy of the Ruby License can be found in COPYING in this repository.