diff --git a/src/lib.rs b/src/lib.rs index c838378..c76c239 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,4 +1,7 @@ -use std::env::{self, args, current_dir}; +use std::{ + env::{self, args, current_dir}, + path::PathBuf, +}; #[cfg(unix)] use std::{fs::File, os::unix::fs::PermissionsExt}; @@ -428,7 +431,12 @@ pub fn get_config_path(app_name: &String) -> AxoupdateResult { if env::var("AXOUPDATER_CONFIG_WORKING_DIR").is_ok() { Ok(Utf8PathBuf::try_from(current_dir()?)?) } else { - let Some(home) = homedir::get_my_home()? else { + let home = if cfg!(windows) { + env::var("LOCALAPPDATA").map(PathBuf::from).ok() + } else { + homedir::get_my_home()? + }; + let Some(home) = home else { return Err(AxoupdateError::NoHome {}); };