#How can I create OS-specific commands?

3 messages · Page 1 of 1 (latest)

lean osprey
#

Or in general, how should I handle the differences in api between the different runtimes?

agile bone
#
#[tauri::command]
fn greet() {
    #[cfg(windows)]
    {
        println!("I only run on Windows");
    }
    println!("I always run");
}
#
#[cfg(windows)]
#[tauri::command]
fn greet() {
    println!("I run on windows");
}

#[cfg(not(windows))]
#[tauri::command]
fn greet() {
    println!("I run everywhere else");
}