allan2 / dotenvy

A well-maintained fork of the Rust dotenv crate
MIT License
625 stars 39 forks source link

windows back slash doesnt work #82

Open JumpyLionnn opened 11 months ago

JumpyLionnn commented 11 months ago

i use windows and when i use back slashes in my env the crate returns an error while trying to parse it.

SOME_VAR=some\path\to\a\file

dotenvy = "0.15.7" rustc 1.70.0 error: LineParse("\"some\\path\\to\\a\\file\"", 4) changing it to forward slashes seems to work

allan2 commented 11 months ago

Could you provide a minimal example with your code and your .env file?

JumpyLionnn commented 11 months ago

sure, here it is .env

PATH=some\path\to\file.txt

src/main.rs

use dotenvy::dotenv;

fn main() {
    dotenv().unwrap();
    println!("var {:?}", std::env::var("PATH"));
}

the error:

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: LineParse("some\\path\\to\\file.txt", 5)', src\main.rs:4:14