Skip to content

Commit 5cb63a5

Browse files
committed
build: added build warning if webui dist folder not present
1 parent 378e8e8 commit 5cb63a5

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

aw-server/build.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
use std::error::Error;
22

33
fn main() -> Result<(), Box<dyn Error>> {
4-
std::fs::create_dir_all("../aw-webui/dist").unwrap();
4+
// if aw-webui/dist does not exist or is empty, print a warning
5+
let path = std::path::Path::new("../aw-webui/dist");
6+
if !path.exists() || path.read_dir()?.next().is_none() {
7+
println!("cargo:warning=`./aw-webui/dist` is not built, compiling without webui");
8+
}
9+
10+
// ensure folder exists, since macro requires it
11+
std::fs::create_dir_all(path)?;
512
println!("cargo:rustc-env=AW_WEBUI_DIR=../aw-webui/dist");
613

714
Ok(())

0 commit comments

Comments
 (0)