win-desktop-utils 0.5.3

Windows desktop helpers for shell, shortcuts, app data, elevation, and single-instance Rust apps
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
fn main() -> Result<(), Box<dyn std::error::Error>> {
    match win_desktop_utils::single_instance_with_scope(
        "demo-app-global",
        win_desktop_utils::InstanceScope::Global,
    )? {
        Some(_guard) => {
            println!("first instance across all sessions");
            println!("press Enter to exit");
            let mut s = String::new();
            std::io::stdin().read_line(&mut s)?;
        }
        None => {
            println!("already running in another session or this one");
        }
    }

    Ok(())
}