go all stabby on ENOTDIR errors #8

isaacs opened this Issue Nov 3, 2011 · 0 comments

2 participants


If the error is an ENOTDIR, then unlink the thing that's in the way, and mkdir on through.

@substack substack pushed a commit that closed this issue Nov 6, 2011
@isaacs isaacs Fix #8, fix #9, and fewer stat calls
The new algorithm is:

1. Try to make the dir.  If that works, then great.
2. If there's an ENOENT or ENOTDIR, then mkdirP the parent.
  1. If that fails, then fail.  Otherwise, try again.
3. If there's an EEXIST, then stat the thing
  1. if it's not a dir, delete it, and try again.
  2. if the mode is wrong, chmod it.
  3. otherwise, all is good, so just cb()
4. Some other error, fail with it.
@substack substack closed this in c4bdf27 Nov 6, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment