@@ -51,6 +51,7 @@ async fn async_watch(
5151 path : & str ,
5252 filter : & Option < regex:: Regex > ,
5353 after_build : Option < String > ,
54+ create_sourcedirs : bool ,
5455) -> notify:: Result < ( ) > {
5556 let mut build_state = build:: initialize_build ( None , filter, path) . expect ( "Can't initialize build" ) ;
5657 let mut needs_compile_type = CompileType :: Incremental ;
@@ -178,7 +179,15 @@ async fn async_watch(
178179 match needs_compile_type {
179180 CompileType :: Incremental => {
180181 let timing_total = Instant :: now ( ) ;
181- if build:: incremental_build ( & mut build_state, None , initial_build, !initial_build) . is_ok ( ) {
182+ if build:: incremental_build (
183+ & mut build_state,
184+ None ,
185+ initial_build,
186+ !initial_build,
187+ create_sourcedirs,
188+ )
189+ . is_ok ( )
190+ {
182191 if let Some ( a) = after_build. clone ( ) {
183192 cmd:: run ( a)
184193 }
@@ -197,7 +206,8 @@ async fn async_watch(
197206 CompileType :: Full => {
198207 let timing_total = Instant :: now ( ) ;
199208 build_state = build:: initialize_build ( None , filter, path) . expect ( "Can't initialize build" ) ;
200- let _ = build:: incremental_build ( & mut build_state, None , initial_build, false ) ;
209+ let _ =
210+ build:: incremental_build ( & mut build_state, None , initial_build, false , create_sourcedirs) ;
201211 if let Some ( a) = after_build. clone ( ) {
202212 cmd:: run ( a)
203213 }
@@ -220,7 +230,12 @@ async fn async_watch(
220230 }
221231}
222232
223- pub fn start ( filter : & Option < regex:: Regex > , folder : & str , after_build : Option < String > ) {
233+ pub fn start (
234+ filter : & Option < regex:: Regex > ,
235+ folder : & str ,
236+ after_build : Option < String > ,
237+ create_sourcedirs : bool ,
238+ ) {
224239 futures:: executor:: block_on ( async {
225240 let queue = Arc :: new ( FifoQueue :: < Result < Event , Error > > :: new ( ) ) ;
226241 let producer = queue. clone ( ) ;
@@ -232,7 +247,7 @@ pub fn start(filter: &Option<regex::Regex>, folder: &str, after_build: Option<St
232247 . watch ( folder. as_ref ( ) , RecursiveMode :: Recursive )
233248 . expect ( "Could not start watcher" ) ;
234249
235- if let Err ( e) = async_watch ( consumer, folder, filter, after_build) . await {
250+ if let Err ( e) = async_watch ( consumer, folder, filter, after_build, create_sourcedirs ) . await {
236251 println ! ( "error: {:?}" , e)
237252 }
238253 } )
0 commit comments