Compare commits
1 Commits
99dc71ca40
...
092658b039
| Author | SHA1 | Date | |
|---|---|---|---|
| 092658b039 |
@@ -51,14 +51,12 @@ impl Rewriter {
|
|||||||
// Create the directory, then carry on. Note that we explore the
|
// Create the directory, then carry on. Note that we explore the
|
||||||
// src_path after creating dst_path.
|
// src_path after creating dst_path.
|
||||||
fs::create_dir(&dst_path)?;
|
fs::create_dir(&dst_path)?;
|
||||||
println!("mkdir {:?}", dst_path);
|
|
||||||
to_visit.push(src_path.into_os_string().into_string().unwrap());
|
to_visit.push(src_path.into_os_string().into_string().unwrap());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Open 2 files; one to read and translate, and one to write.
|
// Open 2 files; one to read and translate, and one to write.
|
||||||
let source_file = File::open(&src_path)?;
|
let source_file = File::open(&src_path)?;
|
||||||
println!("touch {:?}", dst_path);
|
|
||||||
let mut dest_file = File::create(&dst_path)?;
|
let mut dest_file = File::create(&dst_path)?;
|
||||||
let reader = BufReader::new(source_file);
|
let reader = BufReader::new(source_file);
|
||||||
|
|
||||||
@@ -67,7 +65,6 @@ impl Rewriter {
|
|||||||
// If the line is not subject to replacement, copy it and
|
// If the line is not subject to replacement, copy it and
|
||||||
// carry on.
|
// carry on.
|
||||||
if !line.contains(&self.source) {
|
if !line.contains(&self.source) {
|
||||||
println!("{}", line);
|
|
||||||
writeln!(dest_file, "{}", line)?;
|
writeln!(dest_file, "{}", line)?;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -76,7 +73,6 @@ impl Rewriter {
|
|||||||
// in question
|
// in question
|
||||||
for replacement in &replacements {
|
for replacement in &replacements {
|
||||||
let new_line = line.replace(&self.source, &replacement);
|
let new_line = line.replace(&self.source, &replacement);
|
||||||
println!("{}", new_line);
|
|
||||||
writeln!(dest_file, "{}", new_line)?;
|
writeln!(dest_file, "{}", new_line)?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user