File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed
Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -86,9 +86,18 @@ fn cleanup_path_for_python(path: &PathBuf) -> String {
8686 . replace ( "\\ " , "/" )
8787}
8888
89+ fn print_path_for_python ( path : & PathBuf ) -> String {
90+ #[ cfg( not( target_os = "windows" ) ) ] {
91+ format ! ( "\" {}\" " , cleanup_path_for_python( path) )
92+ }
93+ #[ cfg( target_os = "windows" ) ] {
94+ format ! ( "r\" {}\" " , cleanup_path_for_python( path) )
95+ }
96+ }
97+
8998fn init_python ( code : String , dir : PathBuf ) {
9099 #[ allow( unused_mut) ]
91- let mut sys_pyth_dir = vec ! [ format! ( " \" {} \" " , cleanup_path_for_python ( & dir) ) ] ;
100+ let mut sys_pyth_dir = vec ! [ print_path_for_python ( & dir) ] ;
92101 #[ cfg( feature = "venv" ) ]
93102 {
94103 let venv_dir = dir. join ( ".venv" ) . join ( "lib" ) ;
@@ -99,7 +108,7 @@ fn init_python(code: String, dir: PathBuf) {
99108 // use first folder with site-packages for venv, ignore venv version
100109 if Path :: exists ( site_packages. as_path ( ) ) {
101110 sys_pyth_dir
102- . push ( format ! ( " \" {} \" " , cleanup_path_for_python ( & site_packages) ) ) ;
111+ . push ( print_path_for_python ( & site_packages) ) ;
103112 break ;
104113 }
105114 }
You can’t perform that action at this time.
0 commit comments