fix path
This commit is contained in:
@@ -9,11 +9,12 @@ pub fn read_env_var() {
|
|||||||
let mut path = env::var("PWD").unwrap().to_string();
|
let mut path = env::var("PWD").unwrap().to_string();
|
||||||
path.push('/');
|
path.push('/');
|
||||||
path.push_str(filename);
|
path.push_str(filename);
|
||||||
|
println!("{}", path);
|
||||||
|
|
||||||
fs::read_to_string(path)
|
fs::read_to_string(path.clone())
|
||||||
.expect("Something went wrong reading the file : device.env");
|
.expect("Something went wrong reading the file : device.env");
|
||||||
|
|
||||||
if let Ok(lines) = read_lines(filename) {
|
if let Ok(lines) = read_lines(path) {
|
||||||
for line in lines {
|
for line in lines {
|
||||||
if let Ok(var) = line {
|
if let Ok(var) = line {
|
||||||
let new_var: Vec<&str> = var.split('=').collect();
|
let new_var: Vec<&str> = var.split('=').collect();
|
||||||
@@ -33,4 +34,4 @@ fn read_lines<P>(filename: P) -> io::Result<io::Lines<io::BufReader<File>>>
|
|||||||
where P: AsRef<Path>, {
|
where P: AsRef<Path>, {
|
||||||
let file = File::open(filename)?;
|
let file = File::open(filename)?;
|
||||||
Ok(io::BufReader::new(file).lines())
|
Ok(io::BufReader::new(file).lines())
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user