Fix file watching for vim swap files
This commit is contained in:
parent
5d1d0407ca
commit
04d0f78a2c
@ -3,6 +3,7 @@ use crate::verify::verify;
|
|||||||
use clap::{crate_version, App, Arg, SubCommand};
|
use clap::{crate_version, App, Arg, SubCommand};
|
||||||
use notify::DebouncedEvent;
|
use notify::DebouncedEvent;
|
||||||
use notify::{RecommendedWatcher, RecursiveMode, Watcher};
|
use notify::{RecommendedWatcher, RecursiveMode, Watcher};
|
||||||
|
use std::ffi::OsStr;
|
||||||
use std::io::BufRead;
|
use std::io::BufRead;
|
||||||
use std::sync::mpsc::channel;
|
use std::sync::mpsc::channel;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
@ -85,9 +86,11 @@ fn watch() -> notify::Result<()> {
|
|||||||
loop {
|
loop {
|
||||||
match rx.recv() {
|
match rx.recv() {
|
||||||
Ok(event) => match event {
|
Ok(event) => match event {
|
||||||
DebouncedEvent::Chmod(_) | DebouncedEvent::Write(_) => {
|
DebouncedEvent::Create(b) | DebouncedEvent::Chmod(b) | DebouncedEvent::Write(b) => {
|
||||||
|
if b.extension() == Some(OsStr::new("rs")) {
|
||||||
let _ignored = verify();
|
let _ignored = verify();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
},
|
},
|
||||||
Err(e) => println!("watch error: {:?}", e),
|
Err(e) => println!("watch error: {:?}", e),
|
||||||
|
Loading…
Reference in New Issue
Block a user