From 9b0b95673ab34dce91ce2078456e443dd1adf342 Mon Sep 17 00:00:00 2001 From: "Scott C. Livingston" Date: Wed, 1 Jan 2025 17:04:38 -0800 Subject: [PATCH] add Windows as cfg case --- Cargo.toml | 2 +- src/camera.rs | 6 +++--- src/cli.rs | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index f644b77..6128e0b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -41,7 +41,7 @@ tokio = { version = "1.40", features = ["net", "rt", "signal", "sync"] } [target.'cfg(target_os="linux")'.dependencies] v4l = { version = "0.14", features = ["v4l2"] } -[target.'cfg(target_os="macos")'.dependencies] +[target.'cfg(any(target_os="macos", target_os = "windows"))'.dependencies] openpnp_capture = "0.2.4" [dependencies.clap] diff --git a/src/camera.rs b/src/camera.rs index e8d49e9..592faa5 100644 --- a/src/camera.rs +++ b/src/camera.rs @@ -34,7 +34,7 @@ use crate::check::Error as CheckError; pub fn get_default_dev() -> String { #[cfg(target_os = "linux")] return "/dev/video0".into(); - #[cfg(target_os = "macos")] + #[cfg(any(target_os = "macos", target_os = "windows"))] return "0".into(); } @@ -99,7 +99,7 @@ enum CaptureCommand { Quit, // Return from (close) the thread } -#[cfg(target_os = "macos")] +#[cfg(any(target_os = "macos", target_os = "windows"))] fn verify_capture_ability( camera_path: &str, dimensions: Option, @@ -155,7 +155,7 @@ fn verify_capture_ability( Ok(()) } -#[cfg(target_os = "macos")] +#[cfg(any(target_os = "macos", target_os = "windows"))] fn video_capture( camera_path: &str, dimensions: Option, diff --git a/src/cli.rs b/src/cli.rs index 0e22005..2ed238e 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -919,7 +919,7 @@ fn dissolve_subcommand(matches: &clap::ArgMatches) -> Result<(), CliError> { } fn attach_camera_subcommand(matches: &clap::ArgMatches) -> Result<(), CliError> { - #[cfg(not(any(target_os = "linux", target_os = "macos")))] + #[cfg(not(any(target_os = "linux", target_os = "macos", target_os = "windows")))] return CliError::new("only Linux and Mac supported", 1); if matches.values_of("id_prefix").is_some()