From f81228b70b8229496d1498230019507ff48ad9bf Mon Sep 17 00:00:00 2001 From: kastenbutt Date: Sun, 5 Jan 2020 14:23:11 +0100 Subject: [PATCH] Fix issue 32 --- sheep_cli/Cargo.toml | 1 + sheep_cli/src/main.rs | 23 +++++++++++++++++++---- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/sheep_cli/Cargo.toml b/sheep_cli/Cargo.toml index 93d02f3..407b257 100644 --- a/sheep_cli/Cargo.toml +++ b/sheep_cli/Cargo.toml @@ -23,6 +23,7 @@ clap = "2.32" ron = "0.4" oxipng = "2.2" png = "0.15" +glob = "0.3.0" [[bin]] name = "sheep" diff --git a/sheep_cli/src/main.rs b/sheep_cli/src/main.rs index 78d4f91..d7966ec 100644 --- a/sheep_cli/src/main.rs +++ b/sheep_cli/src/main.rs @@ -1,10 +1,12 @@ extern crate clap; +extern crate glob; extern crate image; extern crate ron; extern crate serde; extern crate sheep; use clap::{App, AppSettings, Arg, SubCommand}; +use glob::glob; use serde::Serialize; use sheep::{ AmethystFormat, AmethystNamedFormat, InputSprite, MaxrectsOptions, MaxrectsPacker, @@ -91,10 +93,23 @@ fn main() { match matches.subcommand() { ("pack", Some(matches)) => { - let input = matches - .values_of("INPUT") - .map(|values| values.map(|it| String::from(it)).collect::>()) - .unwrap_or(Vec::new()); + let input = if cfg!(windows) { + matches + .values_of("INPUT") + .unwrap() + .flat_map(|pattern| { + glob(pattern) + .unwrap() + .filter_map(Result::ok) + .map(|path| String::from(path.to_str().unwrap())) + }) + .collect::>() + } else { + matches + .values_of("INPUT") + .map(|values| values.map(|it| String::from(it)).collect::>()) + .unwrap_or(Vec::new()) + }; let out = matches .value_of("output")