File tree Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -572,7 +572,7 @@ pub fn create_dir<P: AsRef<Path>>(path: P) -> io::Result<()> {
572
572
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
573
573
pub fn create_dir_all < P : AsRef < Path > > ( path : P ) -> io:: Result < ( ) > {
574
574
let path = path. as_ref ( ) ;
575
- if path. is_dir ( ) { return Ok ( ( ) ) }
575
+ if path == Path :: new ( "" ) || path . is_dir ( ) { return Ok ( ( ) ) }
576
576
if let Some ( p) = path. parent ( ) { try!( create_dir_all ( p) ) }
577
577
create_dir ( path)
578
578
}
Original file line number Diff line number Diff line change
1
+ // Copyright 2015 The Rust Project Developers. See the COPYRIGHT
2
+ // file at the top-level directory of this distribution and at
3
+ // http://rust-lang.org/COPYRIGHT.
4
+ //
5
+ // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6
+ // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7
+ // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8
+ // option. This file may not be copied, modified, or distributed
9
+ // except according to those terms.
10
+
11
+ use std:: env;
12
+ use std:: fs:: { self , TempDir } ;
13
+
14
+ fn main ( ) {
15
+ let td = TempDir :: new ( "create-dir-all-bare" ) . unwrap ( ) ;
16
+ env:: set_current_dir ( td. path ( ) ) . unwrap ( ) ;
17
+ fs:: create_dir_all ( "create-dir-all-bare" ) . unwrap ( ) ;
18
+ }
You can’t perform that action at this time.
0 commit comments