mirror of
https://github.com/servo/servo.git
synced 2025-08-07 14:35:33 +01:00
Use env::var_os to read paths from the environment
This avoids unnecessary UTF-8 validation on OsStrings that we just pass back to the OS.
This commit is contained in:
parent
fe16c1d5c3
commit
c169f52b25
7 changed files with 19 additions and 18 deletions
|
@ -77,9 +77,10 @@ pub fn default_config_dir() -> Option<PathBuf> {
|
|||
|
||||
#[cfg(target_os = "windows")]
|
||||
pub fn default_config_dir() -> Option<PathBuf> {
|
||||
let mut config_dir = match env::var("APPDATA") {
|
||||
Ok(appdata_path) => PathBuf::from(appdata_path),
|
||||
Err(_) => { let mut dir = env::home_dir().unwrap();
|
||||
let mut config_dir = match env::var_os("APPDATA") {
|
||||
Some(appdata_path) => PathBuf::from(appdata_path),
|
||||
None => {
|
||||
let mut dir = env::home_dir().unwrap();
|
||||
dir.push("Appdata");
|
||||
dir.push("Roaming");
|
||||
dir
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue