got basic action stuff running, now to make error handling better
This commit is contained in:
@ -8,7 +8,7 @@ use std::net::Ipv4Addr;
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
pub const STOP_FILE_NAME: &str = "stop-experiment";
|
||||
pub const HOME_FOLER_EXPERIMENT: &str = "/home/exp278";
|
||||
pub const HOME_FOLDER_EXPERIMENT: &str = "/home/exp278";
|
||||
pub const LOG_FOLDER: &str = "logs";
|
||||
|
||||
pub const OBSW_SERVER_ADDR: Ipv4Addr = Ipv4Addr::UNSPECIFIED;
|
||||
@ -40,12 +40,13 @@ pub enum GroupId {
|
||||
|
||||
lazy_static! {
|
||||
pub static ref HOME_PATH: PathBuf = {
|
||||
let home_path_default = env::var("HOME").expect("HOME env variable not set");
|
||||
let mut home_path = PathBuf::new();
|
||||
home_path.push(if Path::new(HOME_FOLER_EXPERIMENT).exists() {
|
||||
HOME_FOLER_EXPERIMENT
|
||||
let mut home_path_default = homedir::get_my_home().expect("Getting home dir from OS failed.").expect("No home dir found.");
|
||||
|
||||
home_path.push(if Path::new(HOME_FOLDER_EXPERIMENT).exists() {
|
||||
HOME_FOLDER_EXPERIMENT
|
||||
} else {
|
||||
&home_path_default
|
||||
home_path_default.to_str().expect("Error converting to string.")
|
||||
});
|
||||
home_path
|
||||
};
|
||||
|
Reference in New Issue
Block a user