Skip to content

Commit 0249b97

Browse files
committed
use SudoPath + add env to imports
1 parent 85b0373 commit 0249b97

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/common/context.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use std::io;
1+
use std::{env, io};
22

33
use crate::common::{HARDENED_ENUM_VALUE_0, HARDENED_ENUM_VALUE_1, HARDENED_ENUM_VALUE_2};
44
use crate::exec::{RunOptions, Umask};
@@ -36,7 +36,7 @@ pub struct Context {
3636
pub umask: Umask,
3737
// sudoedit
3838
#[cfg_attr(not(feature = "sudoedit"), allow(unused))]
39-
pub files_to_edit: Vec<Option<std::path::PathBuf>>,
39+
pub files_to_edit: Vec<Option<SudoPath>>,
4040
}
4141

4242
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
@@ -77,7 +77,7 @@ impl Context {
7777
let path = if let Some(path) = override_path {
7878
path
7979
} else {
80-
system_path = std::env::var("PATH").unwrap_or_default();
80+
system_path = env::var("PATH").unwrap_or_default();
8181
system_path.as_ref()
8282
};
8383

@@ -122,7 +122,7 @@ impl Context {
122122

123123
let files_to_edit = resolved_args
124124
.clone()
125-
.map(|path| path.ok().map(|path| path.into()))
125+
.map(|path| path.ok().map(SudoPath::from_cli_string))
126126
.collect();
127127

128128
// if a path resolved to something that isn't in UTF-8, it means it isn't in the sudoers file
@@ -211,7 +211,7 @@ impl Context {
211211
let path = if let Some(path) = override_path {
212212
path
213213
} else {
214-
system_path = std::env::var("PATH").unwrap_or_default();
214+
system_path = env::var("PATH").unwrap_or_default();
215215
system_path.as_ref()
216216
};
217217

0 commit comments

Comments
 (0)