Rebase and fix failing tests in mkdirp

This commit is contained in:
David Humphrey (:humph) david.humphrey@senecacollege.ca 2014-03-16 11:47:55 -04:00
parent be9e0b50a8
commit cf29eef1ef
1 changed files with 5 additions and 5 deletions

View File

@ -354,8 +354,8 @@ define(function(require) {
}; };
/** /**
* Recursively creates the directory at `path`. If the parent * Recursively creates the directory at `path`. If the parent
* of `path` does not exist, it will be created. * of `path` does not exist, it will be created.
* Based off EnsureDir by Sam X. Xu * Based off EnsureDir by Sam X. Xu
* https://www.npmjs.org/package/ensureDir * https://www.npmjs.org/package/ensureDir
* MIT License * MIT License
@ -365,7 +365,7 @@ define(function(require) {
callback = callback || function(){}; callback = callback || function(){};
if(!path) { if(!path) {
callback(new Errors.EInvalid()); callback(new Errors.EINVAL('missing path argument'));
return; return;
} }
else if (path === '/'){ else if (path === '/'){
@ -374,7 +374,7 @@ define(function(require) {
} }
function _mkdirp(path, callback){ function _mkdirp(path, callback){
fs.stat(path, function (err, stat) { fs.stat(path, function (err, stat) {
//doesn't exist //doesn't exist
if (err && err.code === 'ENOENT') { if (err && err.code === 'ENOENT') {
var parent = Path.dirname(path); var parent = Path.dirname(path);
if(parent === '/'){ //parent is root if(parent === '/'){ //parent is root
@ -413,7 +413,7 @@ define(function(require) {
} }
//not a directory //not a directory
else if (stat.type === 'FILE') { else if (stat.type === 'FILE') {
callback(new Errors.ENotDirectory()); callback(new Errors.ENOTDIR());
return; return;
} }
}); });