File tree Expand file tree Collapse file tree 1 file changed +15
-7
lines changed
Expand file tree Collapse file tree 1 file changed +15
-7
lines changed Original file line number Diff line number Diff line change 11use std:: error:: Error ;
22
33fn main ( ) -> Result < ( ) , Box < dyn Error > > {
4- // if aw-webui/dist does not exist or is empty, print a warning
5- let path = std:: path:: Path :: new ( "../aw-webui/dist" ) ;
4+ let webui_var = std:: env:: var ( "AW_WEBUI_DIR" ) ;
5+ let path = if let Ok ( var_path) = & webui_var {
6+ std:: path:: Path :: new ( var_path)
7+ } else {
8+ let path = std:: path:: Path :: new ( "../aw-webui/dist" ) ;
9+ // ensure folder exists, since macro requires it
10+ std:: fs:: create_dir_all ( path) ?;
11+ println ! ( "cargo:rustc-env=AW_WEBUI_DIR={}" , path. display( ) ) ;
12+ path
13+ } ;
14+
615 let path_index = path. join ( "index.html" ) ;
716 if !path_index. exists ( ) {
8- println ! ( "cargo:warning=`./aw-webui/dist` is not built, compiling without webui" ) ;
17+ println ! (
18+ "cargo:warning=`{}` is not built, compiling without webui" ,
19+ path. display( )
20+ ) ;
921 }
1022
11- // ensure folder exists, since macro requires it
12- std:: fs:: create_dir_all ( path) ?;
13- println ! ( "cargo:rustc-env=AW_WEBUI_DIR=../aw-webui/dist" ) ;
14-
1523 Ok ( ( ) )
1624}
You can’t perform that action at this time.
0 commit comments