Skip to content

Commit

Permalink
tailord: Delete broken symlink to active profile on startup
Browse files Browse the repository at this point in the history
  • Loading branch information
AaronErhardt committed Oct 23, 2023
1 parent 8539035 commit 6c402ba
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion tailord/src/profiles.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,15 @@ fn init_profiles() {
let profile = ProfileInfo::default();
util::write_json_sync(PROFILE_DIR, DEFAULT_PROFILE_NAME, &profile).ok();
}

// Delete broken symlink
if std::fs::remove_file(ACTIVE_PROFILE_PATH).is_ok() {
tracing::warn!("Broken symlink at {ACTIVE_PROFILE_PATH} was removed");
}

// Create new symlink
let mut default_profile = Path::new(PROFILE_DIR).join(DEFAULT_PROFILE_NAME);
default_profile.set_extension(".json");
default_profile.set_extension("json");
std::os::unix::fs::symlink(default_profile, ACTIVE_PROFILE_PATH).ok();
}

Expand Down

0 comments on commit 6c402ba

Please sign in to comment.