diff --git a/src/processor.rs b/src/processor.rs index 068011f..4abd38c 100644 --- a/src/processor.rs +++ b/src/processor.rs @@ -361,18 +361,51 @@ impl Processor /// Run a Section's compiler for its resource. fn compile_section(&self, section: &Section) { - let exit_code: i32; let args: Vec; - let out: String; - let err: String; - let mut compiler: Command; - let mut arg_compiler: &mut Command; - // Build the arguments to pass to teh compiler. + // Build the arguments to pass to the compiler. args = self.build_args(section); println!("Running compiler {} for resource {} with args '{:?}'.", section.compiler, section.name, args); + if section.compiler.to_lowercase() == "copy" + { + self.run_copier(section, &args); + } + else + { + self.run_compiler(section, &args); + } + } + + fn run_copier(&self, section: &Section, _args: &Vec) + { + if section.src_path != section.dst_path + { + match ::std::fs::copy(Path::new(§ion.src_path), + Path::new(§ion.dst_path)) + { + Ok(bytes) => + { + debug!("Copied {} bytes from {} to {}.", + bytes, section.src_path, section.dst_path); + } + + Err(error) => + { + error!("{}", error); + } + } + } + } + + fn run_compiler(&self, section: &Section, args: &Vec) + { + let exit_code: i32; + let out: String; + let err: String; + let mut compiler: Command; + let mut arg_compiler: &mut Command; // Create a new command to call the compiler to compile this // Section's resource.