Skip to content

Commit

Permalink
Run File Check
Browse files Browse the repository at this point in the history
  • Loading branch information
newtoallofthis123 committed Feb 26, 2024
1 parent 0cd3fe9 commit 1cc3a1f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
20 changes: 10 additions & 10 deletions swhks/src/environ.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Environ.rs
//! Defines modules and structs for handling environment variables and paths.
use std::{path::PathBuf, env::VarError};
use std::{env::VarError, path::PathBuf};

use nix::unistd;

Expand Down Expand Up @@ -39,9 +39,11 @@ impl Env {
Ok(val) => val,
Err(e) => match e {
EnvError::DataHomeNotSet => {
log::warn!("XDG_DATA_HOME Variable is not set, falling back on hardcoded path.");
log::warn!(
"XDG_DATA_HOME Variable is not set, falling back on hardcoded path."
);
home.join(".local/share")
},
}
_ => panic!("Unexpected error: {:#?}", e),
},
};
Expand All @@ -50,18 +52,16 @@ impl Env {
Ok(val) => val,
Err(e) => match e {
EnvError::RuntimeDirNotSet => {
log::warn!("XDG_RUNTIME_DIR Variable is not set, falling back on hardcoded path.");
log::warn!(
"XDG_RUNTIME_DIR Variable is not set, falling back on hardcoded path."
);
PathBuf::from(format!("/run/user/{}", unistd::Uid::current()))
},
}
_ => panic!("Unexpected error: {:#?}", e),
},
};

Self {
data_home,
home,
runtime_dir,
}
Self { data_home, home, runtime_dir }
}

/// Actual interface to get the environment variable.
Expand Down
3 changes: 2 additions & 1 deletion swhks/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ use std::{
os::unix::net::UnixListener,
path::Path,
process::{exit, id, Command, Stdio},
time::{SystemTime, UNIX_EPOCH}, sync::OnceLock,
sync::OnceLock,
time::{SystemTime, UNIX_EPOCH},
};
use sysinfo::{ProcessExt, System, SystemExt};

Expand Down

0 comments on commit 1cc3a1f

Please sign in to comment.