melib: fix debug prints not debug-build only
parent
8e06e298ab
commit
596194fa47
|
@ -316,8 +316,10 @@ eprintln!("removed but not contained in index");
|
||||||
}
|
}
|
||||||
/* Envelope hasn't changed */
|
/* Envelope hasn't changed */
|
||||||
DebouncedEvent::Rename(src, dest) => {
|
DebouncedEvent::Rename(src, dest) => {
|
||||||
eprint!("{}:{}_{}: ", file!(), line!(), column!());
|
if cfg!(debug_assertions) {
|
||||||
eprintln!("DebouncedEvent::Rename(src = {:?}, dest = {:?})", src, dest);
|
eprint!("{}:{}_{}: ", file!(), line!(), column!());
|
||||||
|
eprintln!("DebouncedEvent::Rename(src = {:?}, dest = {:?})", src, dest);
|
||||||
|
}
|
||||||
let folder_hash = get_path_hash!(src);
|
let folder_hash = get_path_hash!(src);
|
||||||
let old_hash: EnvelopeHash = get_file_hash(src.as_path());
|
let old_hash: EnvelopeHash = get_file_hash(src.as_path());
|
||||||
let new_hash: EnvelopeHash = get_file_hash(dest.as_path());
|
let new_hash: EnvelopeHash = get_file_hash(dest.as_path());
|
||||||
|
@ -326,8 +328,10 @@ eprintln!("DebouncedEvent::Rename(src = {:?}, dest = {:?})", src, dest);
|
||||||
let index_lock = hash_indexes_lock.entry(folder_hash).or_default();
|
let index_lock = hash_indexes_lock.entry(folder_hash).or_default();
|
||||||
|
|
||||||
if index_lock.contains_key(&old_hash) {
|
if index_lock.contains_key(&old_hash) {
|
||||||
eprint!("{}:{}_{}: ", file!(), line!(), column!());
|
if cfg!(debug_assertions) {
|
||||||
eprintln!("contains_key");
|
eprint!("{}:{}_{}: ", file!(), line!(), column!());
|
||||||
|
eprintln!("contains_old_key");
|
||||||
|
}
|
||||||
sender.send(RefreshEvent {
|
sender.send(RefreshEvent {
|
||||||
hash: get_path_hash!(dest),
|
hash: get_path_hash!(dest),
|
||||||
kind: Rename(old_hash, new_hash),
|
kind: Rename(old_hash, new_hash),
|
||||||
|
@ -336,15 +340,19 @@ eprintln!("contains_key");
|
||||||
index_lock.insert(new_hash, dest);
|
index_lock.insert(new_hash, dest);
|
||||||
continue;
|
continue;
|
||||||
} else if !index_lock.contains_key(&new_hash) {
|
} else if !index_lock.contains_key(&new_hash) {
|
||||||
eprint!("{}:{}_{}: ", file!(), line!(), column!());
|
if cfg!(debug_assertions) {
|
||||||
eprintln!("not contains_key");
|
eprint!("{}:{}_{}: ", file!(), line!(), column!());
|
||||||
|
eprintln!("not contains_new_key");
|
||||||
|
}
|
||||||
let file_name = dest
|
let file_name = dest
|
||||||
.as_path()
|
.as_path()
|
||||||
.strip_prefix(&root_path)
|
.strip_prefix(&root_path)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.to_path_buf();
|
.to_path_buf();
|
||||||
eprint!("{}:{}_{}: ", file!(), line!(), column!());
|
if cfg!(debug_assertions) {
|
||||||
eprintln!("filename = {:?}", file_name);
|
eprint!("{}:{}_{}: ", file!(), line!(), column!());
|
||||||
|
eprintln!("filename = {:?}", file_name);
|
||||||
|
}
|
||||||
if let Some(env) = add_path_to_index(
|
if let Some(env) = add_path_to_index(
|
||||||
&hash_indexes,
|
&hash_indexes,
|
||||||
folder_hash,
|
folder_hash,
|
||||||
|
@ -352,9 +360,9 @@ eprintln!("contains_key");
|
||||||
&cache_dir,
|
&cache_dir,
|
||||||
file_name,
|
file_name,
|
||||||
) {
|
) {
|
||||||
eprint!("{}:{}_{}: ", file!(), line!(), column!());
|
|
||||||
eprintln!("Create event {} {} {}", env.hash(), env.subject(), dest.display());
|
|
||||||
if cfg!(debug_assertions) {
|
if cfg!(debug_assertions) {
|
||||||
|
eprint!("{}:{}_{}: ", file!(), line!(), column!());
|
||||||
|
eprintln!("Create event {} {} {}", env.hash(), env.subject(), dest.display());
|
||||||
}
|
}
|
||||||
sender.send(RefreshEvent {
|
sender.send(RefreshEvent {
|
||||||
hash: folder_hash,
|
hash: folder_hash,
|
||||||
|
@ -362,15 +370,28 @@ eprintln!("contains_key");
|
||||||
});
|
});
|
||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
|
if cfg!(debug_assertions) {
|
||||||
|
eprint!("{}:{}_{}: ", file!(), line!(), column!());
|
||||||
|
eprintln!("not valid email");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
sender.send(RefreshEvent {
|
||||||
|
hash: get_path_hash!(dest),
|
||||||
|
kind: Rename(old_hash, new_hash),
|
||||||
|
});
|
||||||
|
if cfg!(debug_assertions) {
|
||||||
eprint!("{}:{}_{}: ", file!(), line!(), column!());
|
eprint!("{}:{}_{}: ", file!(), line!(), column!());
|
||||||
eprintln!("not valid email");
|
eprintln!("contains_new_key");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Maybe a re-read should be triggered here just to be safe. */
|
|
||||||
|
/* Maybe a re-read should be triggered here just to be safe.
|
||||||
sender.send(RefreshEvent {
|
sender.send(RefreshEvent {
|
||||||
hash: get_path_hash!(dest),
|
hash: get_path_hash!(dest),
|
||||||
kind: Rescan,
|
kind: Rescan,
|
||||||
});
|
});
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
/* Trigger rescan of folder */
|
/* Trigger rescan of folder */
|
||||||
DebouncedEvent::Rescan => {
|
DebouncedEvent::Rescan => {
|
||||||
|
@ -379,8 +400,11 @@ eprintln!("contains_key");
|
||||||
}
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
},
|
},
|
||||||
Err(e) => {eprint!("{}:{}_{}: ", file!(), line!(), column!());
|
Err(e) => {
|
||||||
eprintln!("watch error: {:?}", e)
|
if cfg!(debug_assertions) {
|
||||||
|
eprint!("{}:{}_{}: ", file!(), line!(), column!());
|
||||||
|
eprintln!("watch error: {:?}", e)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue