@@ -97,9 +97,11 @@ struct ShaderBuilder {
97
97
skip_block_layout : bool ,
98
98
#[ arg( long, default_value = "false" ) ]
99
99
preserve_bindings : bool ,
100
- /// If set, will watch the provided path and recompile on change
100
+ /// If set, will watch the provided directory and recompile on change.
101
+ ///
102
+ /// Can be specified multiple times to watch more than one directory.
101
103
#[ arg( short, long) ]
102
- watch_path : Option < String > ,
104
+ watch_paths : Option < Vec < String > > ,
103
105
}
104
106
105
107
impl ShaderBuilder {
@@ -138,7 +140,7 @@ fn main() {
138
140
}
139
141
println ! ( ) ;
140
142
141
- if args. watch_path . is_none ( ) {
143
+ if args. watch_paths . is_none ( ) {
142
144
return ;
143
145
} ;
144
146
@@ -151,16 +153,19 @@ fn main() {
151
153
let fut_values = async move {
152
154
let mut args = args;
153
155
154
- let Some ( watch_path ) = args. watch_path . take ( ) else {
156
+ let Some ( watch_paths ) = args. watch_paths . take ( ) else {
155
157
unreachable ! ( ) ;
156
158
} ;
157
159
158
- info ! ( "Watching {watch_path:} for changes..." ) ;
159
160
println ! ( ) ;
160
161
{
161
- pool. spawn_ok ( async move {
162
- async_watch ( watch_path, change_tx) . await . unwrap ( ) ;
163
- } ) ;
162
+ for path in watch_paths {
163
+ info ! ( "Watching {path:} for changes..." ) ;
164
+ let change_tx = change_tx. clone ( ) ;
165
+ pool. spawn_ok ( async move {
166
+ async_watch ( path, change_tx) . await . unwrap ( ) ;
167
+ } ) ;
168
+ }
164
169
}
165
170
166
171
loop {
0 commit comments