step nine: Ignore .rgit files

This commit is contained in:
Gonçalo Valério 2020-10-05 19:04:11 +01:00
parent 852157e955
commit 97f9c41bc9
1 changed files with 13 additions and 0 deletions

View File

@ -8,6 +8,11 @@ pub fn write_tree(directory: String) {
let metadata = item.metadata().unwrap();
let name = item.file_name();
let full = format!("{}/{}", directory, name.to_str().unwrap());
if is_ignored(&full) {
continue;
}
if metadata.is_file() {
println!("{}", full);
} else if metadata.is_dir() {
@ -15,3 +20,11 @@ pub fn write_tree(directory: String) {
}
}
}
fn is_ignored(path: &String) -> bool {
if path.contains(".rgit") {
true
} else {
false
}
}