Skip to content

fs::create_dir_all fails if root dir does not exist #23624

Closed

Description

@oakes

The following panics:

use std::fs;

fn main() {
    fs::create_dir_all("a/b/c").unwrap();
}

The following works:

use std::fs;

fn main() {
    fs::create_dir("a").unwrap();
    fs::create_dir_all("a/b/c").unwrap();
}

Apologies in advance if this is intended behavior.

Activity

  1. mvdnes commented on Mar 23, 2015

    @mvdnes
    Contributor

    I have found that it also works when using:

    use std::fs;
    
    fn main() {
        fs::create_dir_all("./a/b/c").unwrap();
    }
  2. alexcrichton commented on Mar 23, 2015

    @alexcrichton
    Member

    This will be fixed by #23383

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions