File tree 1 file changed +10
-4
lines changed
1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -28,13 +28,19 @@ mod testgen {
28
28
let out_dir = PathBuf :: from ( env:: var ( "OUT_DIR" ) . unwrap ( ) ) ;
29
29
let mut dst = File :: create ( Path :: new ( & out_dir) . join ( "tests.rs" ) ) . unwrap ( ) ;
30
30
31
- println ! ( "cargo:rerun-if-changed=tests/headers" ) ;
32
31
let manifest_dir = PathBuf :: from ( env:: var ( "CARGO_MANIFEST_DIR" ) . unwrap ( ) ) ;
33
32
let headers_dir = manifest_dir. join ( "tests" ) . join ( "headers" ) ;
34
33
35
- let entries = fs:: read_dir ( headers_dir)
36
- . expect ( "Couldn't read headers dir" )
37
- . map ( |result| result. expect ( "Couldn't read header file" ) ) ;
34
+ let headers = match fs:: read_dir ( headers_dir) {
35
+ Ok ( dir) => dir,
36
+ // We may not have headers directory after packaging.
37
+ Err ( ..) => return ,
38
+ } ;
39
+
40
+ let entries =
41
+ headers. map ( |result| result. expect ( "Couldn't read header file" ) ) ;
42
+
43
+ println ! ( "cargo:rerun-if-changed=tests/headers" ) ;
38
44
39
45
for entry in entries {
40
46
match entry. path ( ) . extension ( ) . and_then ( OsStr :: to_str) {
You can’t perform that action at this time.
0 commit comments