fix warnings windows

This commit is contained in:
Cyrix126 2024-05-20 12:57:22 +02:00
parent 855a1b3c9d
commit 6b5afd26fa
2 changed files with 9 additions and 13 deletions

View file

@ -180,14 +180,12 @@ pub fn check_xmrig_path(path: &str) -> bool {
#[derive(Clone)] #[derive(Clone)]
pub struct Update { pub struct Update {
pub path_gupax: String, // Full path to current gupax pub path_gupax: String, // Full path to current gupax
pub path_p2pool: String, // Full path to current p2pool pub path_p2pool: String, // Full path to current p2pool
pub path_xmrig: String, // Full path to current xmrig pub path_xmrig: String, // Full path to current xmrig
#[cfg(target_os = "windows")]
pub tmp_dir: String, // Full path to temporary directory
pub updating: Arc<Mutex<bool>>, // Is an update in progress? pub updating: Arc<Mutex<bool>>, // Is an update in progress?
pub prog: Arc<Mutex<f32>>, // Holds the 0-100% progress bar number pub prog: Arc<Mutex<f32>>, // Holds the 0-100% progress bar number
pub msg: Arc<Mutex<String>>, // Message to display on [Gupax] tab while updating pub msg: Arc<Mutex<String>>, // Message to display on [Gupax] tab while updating
} }
impl Update { impl Update {
@ -197,8 +195,6 @@ impl Update {
path_gupax, path_gupax,
path_p2pool: path_p2pool.display().to_string(), path_p2pool: path_p2pool.display().to_string(),
path_xmrig: path_xmrig.display().to_string(), path_xmrig: path_xmrig.display().to_string(),
#[cfg(target_os = "windows")]
tmp_dir: "".to_string(),
updating: arc_mut!(false), updating: arc_mut!(false),
prog: arc_mut!(0.0), prog: arc_mut!(0.0),
msg: arc_mut!(MSG_NONE.to_string()), msg: arc_mut!(MSG_NONE.to_string()),

View file

@ -85,11 +85,8 @@ pub fn get_gupax_data_path() -> Result<PathBuf, TomlError> {
} }
} }
} }
#[cfg(target_family = "unix")]
pub fn set_unix_750_perms(path: &PathBuf) -> Result<(), TomlError> { pub fn set_unix_750_perms(path: &PathBuf) -> Result<(), TomlError> {
#[cfg(target_os = "windows")]
return Ok(());
#[cfg(target_family = "unix")]
match fs::set_permissions(path, fs::Permissions::from_mode(0o750)) { match fs::set_permissions(path, fs::Permissions::from_mode(0o750)) {
Ok(_) => { Ok(_) => {
info!( info!(
@ -124,6 +121,9 @@ pub fn create_gupax_dir(path: &PathBuf) -> Result<(), TomlError> {
return Err(TomlError::Io(e)); return Err(TomlError::Io(e));
} }
} }
#[cfg(target_os = "windows")]
return Ok(());
#[cfg(target_family = "unix")]
set_unix_750_perms(path) set_unix_750_perms(path)
} }