File tree 1 file changed +16
-1
lines changed
1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change
1
+ use std:: ffi:: OsString ;
1
2
use std:: future:: IntoFuture ;
2
3
use std:: io:: Cursor ;
3
4
use std:: path:: { Path , PathBuf } ;
@@ -81,6 +82,12 @@ async fn main() -> anyhow::Result<()> {
81
82
82
83
let inotify = {
83
84
let meta = std:: path:: absolute ( & args. meta ) ?;
85
+ let meta_name: OsString = match meta. file_name ( ) {
86
+ Some ( parent) => parent. into ( ) ,
87
+ None => {
88
+ anyhow:: bail!( "Failed to watch for meta file changes. Filename could not be deteminated." )
89
+ }
90
+ } ;
84
91
let meta_parent = match meta. parent ( ) {
85
92
Some ( parent) => parent. to_path_buf ( ) ,
86
93
None => anyhow:: bail!(
@@ -96,7 +103,15 @@ async fn main() -> anyhow::Result<()> {
96
103
let mut buf = [ 0 ; 1024 ] ;
97
104
let mut stream = inotify. into_event_stream ( & mut buf) ?;
98
105
99
- while stream. next ( ) . await . transpose ( ) ?. is_some ( ) {
106
+ while let Some ( event) = stream. next ( ) . await . transpose ( ) ? {
107
+ let name = match event. name {
108
+ Some ( name) => name,
109
+ None => continue ,
110
+ } ;
111
+
112
+ if name != meta_name {
113
+ continue ;
114
+ }
100
115
meta_update_tx. send ( ( ) ) . await . unwrap ( )
101
116
}
102
117
You can’t perform that action at this time.
0 commit comments