File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -16,9 +16,18 @@ pub fn write_to_outdirs(_item: TokenStream) -> TokenStream {
1616 // Write to the output directories declared by Bazel
1717 for entry in outdirs_paths. split ( ',' ) {
1818 if let Some ( ( _dir, path) ) = entry. split_once ( ':' ) {
19- let dir_path = PathBuf :: from ( path. trim ( ) ) ;
20-
19+ let path_str = path. trim ( ) ;
20+ // PathBuf will normalize the path correctly for the current platform
21+ // On Windows, ensure forward slashes are converted to backslashes
22+ let dir_path = if cfg ! ( windows) {
23+ // Convert forward slashes to backslashes for Windows
24+ PathBuf :: from ( path_str. replace ( '/' , "\\ " ) )
25+ } else {
26+ PathBuf :: from ( path_str)
27+ } ;
28+
2129 // Create the directory if it doesn't exist
30+ // create_dir_all creates all parent directories as needed
2231 if let Err ( e) = fs:: create_dir_all ( & dir_path) {
2332 panic ! ( "Failed to create directory {}: {:?}" , dir_path. display( ) , e) ;
2433 }
You can’t perform that action at this time.
0 commit comments