Handle random jetbrains temp files

This commit is contained in:
Vincent Prouillet 2021-02-28 22:30:56 +01:00
parent 2a46e07e74
commit 51644a79e3

View file

@ -468,7 +468,7 @@ pub fn serve(
match rx.recv() { match rx.recv() {
Ok(event) => { Ok(event) => {
let can_do_fast_reload = !matches!(event, Remove(_)); let can_do_fast_reload = !matches!(event, Remove(_));
match event { match event {
// Intellij does weird things on edit, chmod is there to count those changes // Intellij does weird things on edit, chmod is there to count those changes
// https://github.com/passcod/notify/issues/150#issuecomment-494912080 // https://github.com/passcod/notify/issues/150#issuecomment-494912080
@ -477,7 +477,7 @@ pub fn serve(
continue; continue;
} }
if path.is_file() && is_temp_file(&path) { if is_temp_file(&path) {
continue; continue;
} }
@ -485,7 +485,6 @@ pub fn serve(
if path.is_dir() && is_folder_empty(&path) { if path.is_dir() && is_folder_empty(&path) {
continue; continue;
} }
println!( println!(
"Change detected @ {}", "Change detected @ {}",
Local::now().format("%Y-%m-%d %H:%M:%S").to_string() Local::now().format("%Y-%m-%d %H:%M:%S").to_string()
@ -600,7 +599,7 @@ fn is_temp_file(path: &Path) -> bool {
x if x.ends_with("jb_old___") => true, x if x.ends_with("jb_old___") => true,
x if x.ends_with("jb_tmp___") => true, x if x.ends_with("jb_tmp___") => true,
x if x.ends_with("jb_bak___") => true, x if x.ends_with("jb_bak___") => true,
// vim // vim & jetbrains
x if x.ends_with('~') => true, x if x.ends_with('~') => true,
_ => { _ => {
if let Some(filename) = path.file_stem() { if let Some(filename) = path.file_stem() {