Skip to content

file.mkdir does not create intermediate directories any more #1764

@ssaarinen

Description

@ssaarinen

Stumbled on this while upgrading an old build to newer grunt version. There is a plugin (grunt-ng-constant) that uses grunt.file.write and expects the intermediate directories to be created if they do not exist.

file.write still calls file.mkdir

file.mkdir(path.dirname(filepath));

which still states that it does this (like mkdir -p)

// Like mkdir -p. Create a directory and any intermediary directories.

But infact it does not and build fails (on 1.6.1) with
Warning: Unable to create directory "src/js" (Error code: EEXIST). if directory exists or ENOENT if it does not (and the hierarchy is more than 1 level, if i'm not not mistaken)

This works as expected w/ 1.5.3 (1.6.0 shows some syntax error)

API docs for file.write still state that

Write the specified contents to a file, creating intermediate directories if necessary.

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