some bugfixes
This commit is contained in:
@ -55,32 +55,30 @@ pub enum GroupId {
|
||||
pub const TEST_EVENT: EventU32TypedSev<SeverityInfo> =
|
||||
EventU32TypedSev::<SeverityInfo>::new(GroupId::Tmtc as u16, 0);
|
||||
|
||||
pub fn set_up_home_path() {
|
||||
pub fn set_up_home_path() -> PathBuf {
|
||||
let mut home_path = PathBuf::new();
|
||||
let 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
|
||||
if cfg!(feature = "host") {
|
||||
home_path = std::env::current_dir()
|
||||
.expect("getting current dir failed")
|
||||
.to_path_buf();
|
||||
} else {
|
||||
home_path_default
|
||||
.to_str()
|
||||
.expect("Error converting to string.")
|
||||
});
|
||||
let home_path_default = homedir::get_my_home()
|
||||
.expect("Getting home dir from OS failed.")
|
||||
.expect("No home dir found.");
|
||||
if Path::new(HOME_FOLDER_EXPERIMENT).exists() {
|
||||
home_path.push(HOME_FOLDER_EXPERIMENT);
|
||||
} else {
|
||||
home_path = home_path_default;
|
||||
}
|
||||
}
|
||||
HOME_PATH
|
||||
.set(home_path)
|
||||
.expect("attempting to set once cell twice")
|
||||
.set(home_path.clone())
|
||||
.expect("attempting to set once cell twice");
|
||||
home_path
|
||||
}
|
||||
|
||||
pub fn set_up_low_prio_ground_dir(base_path: PathBuf) {
|
||||
/*
|
||||
#[cfg(feature = "host")]
|
||||
let mut to_ground_lp_dir = std::env::current_dir().expect("getting current dir failed");
|
||||
#[cfg(not(feature = "host"))]
|
||||
let mut to_ground_lp_dir = home_path;
|
||||
*/
|
||||
let mut to_ground_lp_dir = base_path.to_path_buf();
|
||||
pub fn set_up_low_prio_ground_dir(home_path: PathBuf) {
|
||||
let mut to_ground_lp_dir = home_path.to_path_buf();
|
||||
to_ground_lp_dir.push(TO_GROUND_LP_FOLDER_NAME);
|
||||
if !Path::new(&to_ground_lp_dir).exists() {
|
||||
log::info!(
|
||||
@ -99,14 +97,8 @@ pub fn set_up_low_prio_ground_dir(base_path: PathBuf) {
|
||||
.expect("attemting to set once cell twice");
|
||||
}
|
||||
|
||||
pub fn set_up_ground_dir(base_path: PathBuf) {
|
||||
/*
|
||||
#[cfg(feature = "host")]
|
||||
let mut to_ground_dir = std::env::current_dir().expect("getting current dir failed");
|
||||
#[cfg(not(feature = "host"))]
|
||||
let mut to_ground_dir = HOME_PATH.clone();
|
||||
*/
|
||||
let mut to_ground_dir = base_path.to_path_buf();
|
||||
pub fn set_up_ground_dir(home_path: PathBuf) {
|
||||
let mut to_ground_dir = home_path.to_path_buf();
|
||||
to_ground_dir.push(TO_GROUND_FOLDER_NAME);
|
||||
if !Path::new(&to_ground_dir).exists() {
|
||||
log::info!("creating to ground directory at {:?}", to_ground_dir);
|
||||
|
Reference in New Issue
Block a user