File tree Expand file tree Collapse file tree 1 file changed +15
-9
lines changed Expand file tree Collapse file tree 1 file changed +15
-9
lines changed Original file line number Diff line number Diff line change @@ -213,16 +213,22 @@ impl ModuleWriter for PathWriter {
213213 . with_context ( || format ! ( "Failed to create directory {}" , parent_dir. display( ) ) ) ?;
214214 }
215215
216- let mut options = OpenOptions :: new ( ) ;
217- options. create ( true ) . write ( true ) . truncate ( true ) ;
218- #[ cfg( unix) ]
219- {
220- options. mode ( default_permission ( executable) ) ;
216+ let mut file = {
217+ #[ cfg( target_family = "unix" ) ]
218+ {
219+ OpenOptions :: new ( )
220+ . create ( true )
221+ . write ( true )
222+ . truncate ( true )
223+ . mode ( default_permission ( executable) )
224+ . open ( & path)
225+ }
226+ #[ cfg( target_os = "windows" ) ]
227+ {
228+ File :: create ( & path)
229+ }
221230 }
222-
223- let mut file = options
224- . open ( & path)
225- . with_context ( || format ! ( "Failed to create a file at {}" , path. display( ) ) ) ?;
231+ . with_context ( || format ! ( "Failed to create a file at {}" , path. display( ) ) ) ?;
226232 let mut writer = StreamSha256 :: new ( & mut file) ;
227233
228234 io:: copy ( & mut data, & mut writer)
You can’t perform that action at this time.
0 commit comments