use std::process::Command; fn main() { for shader in glob::glob("res/shaders/*").unwrap().filter_map(Result::ok) { if !shader.is_file() { continue; } let shader_file_name = shader.to_str().unwrap(); let mut command = Command::new("glslc"); command.arg(&shader); let out_file = match shader.extension().unwrap().to_str().unwrap() { "vert" => shader_file_name.replace(".vert", ".vert.spv"), "frag" => shader_file_name.replace(".frag", ".frag.spv"), _ => continue, }; command.arg("-o"); command.arg(out_file); command.output().unwrap(); } }