@@ -14,7 +14,7 @@ use std::fs::File;
1414use  std:: io:: BufReader ; 
1515use  std:: path:: Path ; 
1616use  std:: time:: Duration ; 
17- use  tracing:: { debug,  error,  warn} ; 
17+ use  tracing:: { debug,  error,  trace ,   warn} ; 
1818
1919pub  struct  CommandDiscovery  { 
2020} 
@@ -54,13 +54,22 @@ impl CommandDiscovery {
5454        let  mut  resources:  BTreeMap < String ,  DscResource >  = BTreeMap :: new ( ) ; 
5555        let  mut  adapter_resources:  Vec < String >  = Vec :: new ( ) ; 
5656        let  mut  remaining_required_resource_types = required_resource_types. to_owned ( ) ; 
57+         let  mut  using_custom_path = false ; 
5758
5859        // try DSC_RESOURCE_PATH env var first otherwise use PATH 
5960        let  path_env = match  env:: var_os ( "DSC_RESOURCE_PATH" )  { 
60-             Some ( value)  => value, 
61+             Some ( value)  => { 
62+                 debug ! ( "Using DSC_RESOURCE_PATH: {:?}" ,  value. to_string_lossy( ) ) ; 
63+                 using_custom_path = true ; 
64+                 value
65+             } , 
6166            None  => { 
67+                 trace ! ( "DSC_RESOURCE_PATH not set, trying PATH" ) ; 
6268                match  env:: var_os ( "PATH" )  { 
63-                     Some ( value)  => value, 
69+                     Some ( value)  => { 
70+                         debug ! ( "Using PATH: {:?}" ,  value. to_string_lossy( ) ) ; 
71+                         value
72+                     } 
6473                    None  => { 
6574                        return  Err ( DscError :: Operation ( "Failed to get PATH environment variable" . to_string ( ) ) ) ; 
6675                    } 
@@ -71,9 +80,11 @@ impl CommandDiscovery {
7180        let  mut  paths = env:: split_paths ( & path_env) . collect :: < Vec < _ > > ( ) ; 
7281
7382        // add exe home to start of path 
74-         if  let  Some ( exe_home)  = env:: current_exe ( ) ?. parent ( )  { 
75-             debug ! ( "Adding exe home to path: {}" ,  exe_home. to_string_lossy( ) ) ; 
76-             paths. insert ( 0 ,  exe_home. to_path_buf ( ) ) ; 
83+         if  !using_custom_path { 
84+             if  let  Some ( exe_home)  = env:: current_exe ( ) ?. parent ( )  { 
85+                 debug ! ( "Adding exe home to path: {}" ,  exe_home. to_string_lossy( ) ) ; 
86+                 paths. insert ( 0 ,  exe_home. to_path_buf ( ) ) ; 
87+             } 
7788        } 
7889
7990        for  path in  paths { 
0 commit comments