diff --git a/src/any/mod.rs b/src/any/mod.rs index ef34416..7c40958 100644 --- a/src/any/mod.rs +++ b/src/any/mod.rs @@ -16,3 +16,6 @@ pub fn screenshot_and_save( ) -> anyhow::Result<()> { unimplemented!("there is only an impl for MacOS") } + +// references for winRT +// https://github.com/robmikh/wgc-rust-demo/blob/master/src/main.rs diff --git a/src/main.rs b/src/main.rs index ecf0150..4f3f31d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -15,7 +15,7 @@ use anyhow::Context; use anyhow::Result; use std::borrow::Borrow; use std::ffi::OsStr; -use std::process::{Command, ExitStatus}; +use std::process::{Command, ExitStatus, Output}; use std::sync::mpsc::Receiver; use std::sync::{mpsc, Arc, Mutex}; use std::time::{Duration, Instant}; @@ -48,6 +48,8 @@ fn main() -> Result<()> { } }; + check_for_imagemagick()?; + // the nice thing is the cleanup on drop let tempdir = Arc::new(Mutex::new( TempDir::new().context("Cannot create tempdir.")?, @@ -149,6 +151,16 @@ fn current_win_id() -> Result { } } +/// +/// checks for imagemagick +/// and suggests the installation command if there are issues +fn check_for_imagemagick() -> Result { + Command::new("convert") + .arg("--version") + .output() + .context("There is an issue with 'convert', make sure you have it installed: `brew install imagemagick`") +} + /// /// generating the final gif with help of convert fn generate_gif_with_convert(time_codes: &[u128], tempdir: &TempDir) -> Result<()> {