Skip to content

Commit

Permalink
Corrected mkdir for Java 6 such that if a parent directory does not e…
Browse files Browse the repository at this point in the history
…xist then ENOENT is thrown. Node actually isn't clear on what should happen here, but the mkdirp module certainly expects ENOENT. In addition the Java 7 version works. I would think that it works because a fileNotFound exception is turned into ENOENT within AsyncFileSystem.
  • Loading branch information
huntc committed Apr 5, 2014
1 parent 1b3be06 commit 14363e7
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -727,17 +727,18 @@ private void doMkdir(String path, int mode)
{
File file = translatePath(path);
if (file.exists()) {
NodeOSException ne = new NodeOSException(Constants.EEXIST);
ne.setPath(path);
throw ne;
throw new NodeOSException(Constants.EEXIST, path);
}
if (file.getParentFile() != null && !file.getParentFile().exists()) {
throw new NodeOSException(Constants.ENOENT, path);
}
if (!file.mkdir()) {
throw new NodeOSException(Constants.EIO);
throw new NodeOSException(Constants.EIO, path);
}
try {
setMode(file, mode);
} catch (IOException ioe) {
throw new NodeOSException(Constants.EIO, ioe);
throw new NodeOSException(Constants.EIO, ioe, path);
}
}

Expand Down

0 comments on commit 14363e7

Please sign in to comment.