fix file env path
This commit is contained in:
@@ -6,25 +6,23 @@ use std::path::Path;
|
||||
|
||||
pub fn read_env_var() {
|
||||
let filename = "device.env";
|
||||
// println!("In file {}", filename);
|
||||
let mut path = env::var("PWD").unwrap().to_string();
|
||||
path.push('/');
|
||||
path.push_str(filename);
|
||||
|
||||
fs::read_to_string(filename)
|
||||
fs::read_to_string(path)
|
||||
.expect("Something went wrong reading the file : device.env");
|
||||
|
||||
|
||||
if let Ok(lines) = read_lines(filename) {
|
||||
// Consumes the iterator, returns an (Optional) String
|
||||
for line in lines {
|
||||
if let Ok(var) = line {
|
||||
let new_var: Vec<&str> = var.split('=').collect();
|
||||
env::set_var(new_var[0], new_var[1]);
|
||||
// println!("Ma ligne : {:?}", new_var);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// println!("\n");
|
||||
|
||||
// for (key, value) in env::vars() {
|
||||
// println!("{}: {}", key, value);
|
||||
// }
|
||||
|
||||
Reference in New Issue
Block a user