Skip to content

Commit

Permalink
fix: 🐛 panic on startup when init the singleton guard
Browse files Browse the repository at this point in the history
  • Loading branch information
wjian23 committed Feb 8, 2024
1 parent fcf5dc7 commit 6d573fc
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions gui/src/platform.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@ pub use linux::{app_init_hook, app_run_before_hook, has_permission, permission_p
fn singleton_guard() -> bool {
use fs4::FileExt;
use once_cell::sync::Lazy;
use polestar_core::create_if_not_exist_dir;
use polestar_core::project_home_path;
use ribir::prelude::log::warn;
use std::fs::OpenOptions;

create_if_not_exist_dir(project_home_path());
static GUARD_FILE: Lazy<(Result<std::fs::File, std::io::Error>, bool)> = Lazy::new(|| {
let file_path = format!("{}/{}", project_home_path().display(), "/singleton_guard");
let file = OpenOptions::new().create(true).write(true).open(file_path);
Expand Down

0 comments on commit 6d573fc

Please sign in to comment.