set_env_perm 2.0.1

Sets environment variables permanently across all major platforms
Documentation
  • Coverage
  • 62.5%
    5 out of 8 items documented1 out of 6 items with examples
  • Size
  • Source code size: 18.79 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.7 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 27s Average build duration of successful builds.
  • all releases: 25s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • TobiasGrothmann/set_env_perm
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • TobiasGrothmann

set_env_perm

This crate allows you to permanently set environment variables

Based on set_env

Examples

// Check if DUMMY is set, if not set it to 1
// export DUMMY=1
set_env_perm::check_or_set("DUMMY", 1).expect("Failed to find or set DUMMY");
// Append $HOME/some/cool/bin to $PATH
// export PATH= "$HOME/some/cool/bin:$PATH"Cancel changes
set_env_perm::append("PATH", "$HOME/some/cool/bin").expect("Couldn't find PATH");
// Sets a variable without checking if it exists.
// Note you need to use a raw string literal to include ""
// export DUMMY="/something"
set_env_perm::set("DUMMY", r#""/something""#).expect("Failed to set DUMMY");

Usage

This crate simply appends to your .bash_profile or .bash_login or .profile in that order. It will create a .bash_profile file if none of the above are found in your home directory. ie. /Users/me/.bash_profile.

On windows, this crate will modify the HKEY_CURRENT_USER\Environment registry items