A simple proc macro to generate a const list of filenames and optionally apply a macro to each.
```rust use std::fs::canonicalize;
use listfilesmacro::list_files;
fn getfullpath(path: &str) -> String { canonicalize(path).unwrap().intoosstring().into_string().unwrap() }
const FILENAMES: [&'static str; 3] = list_files!("../tests/files/*.rs");
asserteq!(FILENAMES, [ "tests/files/a.rs", "tests/files/b.rs", "tests/files/c.rs", ].map(getfull_path));
const CONTENTS: [&'static str; 3] = listfiles!(includestr, "../tests/files/*.rs");
assert_eq!(CONTENTS[0], r#" pub fn run() -> &'static str { "A" } "#);
macrorules! runfile { ($x:expr) => { { #[path = $x] mod file; file::run() } }; }
let results = listfiles!(runfile, "../tests/files/*.rs");
assert_eq!(results, [ "A", "B", "C", ]); ```
To use this, add it as a dependency to your Cargo.toml:
toml
[dependencies]
list_files_macro = "^0.1.0"