Skip to content

Commit baeeda1

Browse files
committed
Add an error message when the languages directories are empty
1 parent 1700a6e commit baeeda1

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

build.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,15 @@ fn build_cpp(files: Vec<String>, language: &str) {
126126
}
127127

128128
fn build_dir(dir: &str, language: &str) {
129-
eprintln!("Build language {}", language);
129+
println!("Build language {}", language);
130+
if PathBuf::from(dir).read_dir().unwrap().next().is_none() {
131+
eprintln!(
132+
"The directory {} is empty, did you use 'git clone --recursive'?",
133+
dir
134+
);
135+
eprintln!("You can fix in using 'git submodule init && git submodule update --recursive'.");
136+
std::process::exit(1);
137+
}
130138
let (c, cpp) = collect_src_files(&dir);
131139
if !c.is_empty() {
132140
build_c(c, &language);

0 commit comments

Comments
 (0)