File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed
Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -20,19 +20,26 @@ pub(crate) fn cargo_rerun_if_changed(metadata: &Metadata, program_dir: &Path) {
2020 ] ;
2121 for dir in dirs {
2222 if dir. exists ( ) {
23- println ! ( "cargo::rerun-if-changed={}" , dir. canonicalize( ) . unwrap( ) . display( ) ) ;
23+ if let Ok ( canonical_path) = dir. canonicalize ( ) {
24+ println ! ( "cargo::rerun-if-changed={}" , canonical_path. display( ) ) ;
25+ } else {
26+ println ! (
27+ "cargo::warning=Could not canonicalize path: {dir:?}, using original path"
28+ ) ;
29+ println ! ( "cargo::rerun-if-changed={}" , dir. display( ) ) ;
30+ }
2431 }
2532 }
2633
2734 // Re-run the build script if the workspace root's Cargo.lock changes. If the program is its own
2835 // workspace, this will be the program's Cargo.lock.
29- println ! ( "cargo:rerun-if-changed={}" , metadata. workspace_root. join( "Cargo.lock" ) . as_str( ) ) ;
36+ println ! ( "cargo:: rerun-if-changed={}" , metadata. workspace_root. join( "Cargo.lock" ) . as_str( ) ) ;
3037
3138 // Re-run if any local dependency changes.
3239 for package in & metadata. packages {
3340 for dependency in & package. dependencies {
3441 if let Some ( path) = & dependency. path {
35- println ! ( "cargo:rerun-if-changed={}" , path. as_str( ) ) ;
42+ println ! ( "cargo:: rerun-if-changed={}" , path. as_str( ) ) ;
3643 }
3744 }
3845 }
You can’t perform that action at this time.
0 commit comments