This now correctly handles the special copy case.
This commit is contained in:
parent
fbcc43b2eb
commit
ec1dbe7e46
@ -361,18 +361,51 @@ impl Processor
|
|||||||
/// Run a Section's compiler for its resource.
|
/// Run a Section's compiler for its resource.
|
||||||
fn compile_section(&self, section: &Section)
|
fn compile_section(&self, section: &Section)
|
||||||
{
|
{
|
||||||
let exit_code: i32;
|
|
||||||
let args: Vec<String>;
|
let args: Vec<String>;
|
||||||
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);
|
args = self.build_args(section);
|
||||||
|
|
||||||
println!("Running compiler {} for resource {} with args '{:?}'.",
|
println!("Running compiler {} for resource {} with args '{:?}'.",
|
||||||
section.compiler, section.name, 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<String>)
|
||||||
|
{
|
||||||
|
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<String>)
|
||||||
|
{
|
||||||
|
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
|
// Create a new command to call the compiler to compile this
|
||||||
// Section's resource.
|
// Section's resource.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user