Cosmetics
parent
4cb09cd6a9
commit
5683a7d10c
11
src/main.rs
11
src/main.rs
|
@ -50,7 +50,7 @@ impl Args {
|
|||
result = false;
|
||||
println!("Error, input ( {} ) is not a valid directory", self.input);
|
||||
}
|
||||
|
||||
|
||||
if ! Path::new(&self.output).exists() {
|
||||
result = false;
|
||||
println!("Error, output ({} ) is not a valid directory", self.output);
|
||||
|
@ -66,10 +66,10 @@ impl Args {
|
|||
true
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
fn check_not_parent(&self) -> bool {
|
||||
let vec = vec![&self.input, &self.output];
|
||||
|
||||
|
||||
for (i, x) in vec.iter().enumerate() {
|
||||
let mut a = Path::new(x);
|
||||
let tmp = match i {
|
||||
|
@ -173,7 +173,7 @@ fn main() {
|
|||
// symlink_metadata does not follow symlink :-]
|
||||
let metadata = fs::symlink_metadata(entry.path()).unwrap();
|
||||
let ft = metadata.file_type();
|
||||
|
||||
|
||||
if ft.is_file() {
|
||||
if let Ok(mut file) = fs::File::open(&entry.path()) {
|
||||
process::<Sha256, _>(&mut file,
|
||||
|
@ -184,7 +184,7 @@ fn main() {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// let inputs = fs::read_dir(&args.input).unwrap();
|
||||
// for path in inputs {
|
||||
// let path_str = path.unwrap().path().into_os_string().into_string().unwrap();
|
||||
|
@ -208,6 +208,7 @@ fn main() {
|
|||
fn process<D: Digest + Default, R: Read>(reader: &mut R, name: &str) {
|
||||
let mut sh = D::default();
|
||||
let mut buffer = [0u8; BUFFER_SIZE];
|
||||
|
||||
loop {
|
||||
let n = match reader.read(&mut buffer) {
|
||||
Ok(n) => n,
|
||||
|
|
Loading…
Reference in New Issue