Skip to content

EffectCraft: An open-source motion graphics and compositing tool written by scratch in pure Rust

App: only a held lock means another launch is starting (#283 follow-up)

Brandon Thomas11848da0a102
diff --git a/apps/effectcraft/src/launch_guard.rs b/apps/effectcraft/src/launch_guard.rs
index 5636f988b..14c4c440e 100644
--- a/apps/effectcraft/src/launch_guard.rs
+++ b/apps/effectcraft/src/launch_guard.rs
@@ -40,7 +40,7 @@ impl Launch {
let mut prefs = std::fs::read_to_string(&prefs_path).map(|t| Prefs::from_json(&t)).unwrap_or_default();
let marker = dir.join(MARKER);
// Locked by another launch that is still opening its window: not a crash.
- let held = File::open(&marker).is_ok_and(|f| f.try_lock().is_err());
+ let held = File::open(&marker).is_ok_and(|f| matches!(f.try_lock(), Err(std::fs::TryLockError::WouldBlock)));
let mut notice = None;
if marker.exists() && !held && prefs.startup.window_graphics == "auto" && cfg!(not(target_os = "macos")) {
prefs.startup.window_graphics = "gl".into();