fn compare_files(local_file : &Path, source_file: &Path)
{
	//create sha1 sums
	let local_checksum = sha1sum(local_file);
	let source_checksum = sha1sum(source_file);
	
	if local_checksum == source_checksum {
		println!("Checksum of both file are identical");
		return;
	}
	
	let local_file_meta = local_file.metadata().unwrap();
	let source_file_meta = source_file.metadata().unwrap();
	
	//if differs check modified date
	if local_file_meta.modified() < source_file_meta.modified() {
		//<local> <source>/
		println!("{} is newer than {}", source_file.display(), local_file.display());
	}
	
	if local_file_meta.modified() > source_file_meta.modified() {
		println!("{} is newer than {}", local_file.display(), source_file.display());
	}
	
	if local_file_meta.modified() == source_file_meta.modified() {
		println!("{} seems identical {}", local_file.display(), source_file.display());
	}
	
	//call diff command?
}
/**
* compare two files (part of diff command)
*/
compare two files (part of diff command)
compare two files ( part of diff command )
fn compare_files(local_file : &Path, source_file: &Path)
{
	//create sha1 sums
	let local_checksum = sha1sum(local_file);
	let source_checksum = sha1sum(source_file);
	if local_checksum == source_checksum {
		println!("Checksum of both file are identical");
		return;
	}
	let local_file_meta = local_file.metadata().unwrap();
	let source_file_meta = source_file.metadata().unwrap();
	//if differs check modified date
	if local_file_meta.modified() < source_file_meta.modified() {
		//<local> <source>/
		println!("{} is newer than {}", source_file.display(), local_file.display());
	}
	if local_file_meta.modified() > source_file_meta.modified() {
		println!("{} is newer than {}", local_file.display(), source_file.display());
	}
	if local_file_meta.modified() == source_file_meta.modified() {
		println!("{} seems identical {}", local_file.display(), source_file.display());
	}
	//call diff command?
}
fn compare_files ( local_file : & Path , source_file : & Path ) { //create sha1 sums let local_checksum = sha1sum ( local_file ) ; let source_checksum = sha1sum ( source_file ) ; if local_checksum == source_checksum { println ! ( " " ) ; return ; } let local_file_meta = local_file . metadata ( ) . unwrap ( ) ; let source_file_meta = source_file . metadata ( ) . unwrap ( ) ; //if differs check modified date if local_file_meta . modified ( ) < source_file_meta . modified ( ) { //<local> <source>/ println ! ( " " source_file display ( ) local_file display ( ) ) ; } if local_file_meta . modified ( ) > source_file_meta . modified ( ) { println ! ( " " local_file display ( ) source_file display ( ) ) ; } if local_file_meta . modified ( ) == source_file_meta . modified ( ) { println ! ( " " local_file display ( ) source_file display ( ) ) ; } //call diff command? }
compare two files (part of diff command)
compare two files ( part of diff command )
local_file
&Path
source_file
&Path
local_file
&Path
source_file
&Path