Comparing version 0.1.12 to 0.1.13
@@ -9,3 +9,3 @@ /** | ||
* | ||
* @version 0.1.12 | ||
* @version 0.1.13 | ||
*/ | ||
@@ -292,19 +292,25 @@ | ||
var dirName = path.dirname(dirPath); | ||
return vfs.exists(dirName).then(function(exists) { | ||
return exists? | ||
makeDir(dirPath, mode).fail(function(e) { | ||
if(e.code !== 'EEXIST' || failIfExist) { | ||
var dirName = path.dirname(dirPath), | ||
onFailed = function(e) { | ||
if(e.code !== 'EEXIST' || failIfExist) { | ||
throw e; | ||
} | ||
return vfs.isDir(dirPath).then(function(isDir) { | ||
if(!isDir) { | ||
throw e; | ||
} | ||
}); | ||
}; | ||
return vfs.isDir(dirPath).then(function(isDir) { | ||
if(!isDir) { | ||
throw e; | ||
} | ||
}); | ||
}) : | ||
vfs.makeDir(dirName, mode).then(function() { | ||
return makeDir(dirPath, mode); | ||
return vfs.exists(dirName).then(function(exists) { | ||
if(exists) { | ||
return makeDir(dirPath, mode).fail(onFailed); | ||
} | ||
else { | ||
failIfExist = false; | ||
return vfs.makeDir(dirName, mode).then(function() { | ||
return makeDir(dirPath, mode).fail(onFailed); | ||
}); | ||
} | ||
}); | ||
@@ -311,0 +317,0 @@ }, |
{ | ||
"name" : "vow-fs", | ||
"version" : "0.1.12", | ||
"version" : "0.1.13", | ||
"description" : "File I/O by Vow", | ||
@@ -5,0 +5,0 @@ "homepage" : "https://github.com/dfilatov/vow-fs", |
44
test.js
var vfs = require('./lib/fs'); | ||
vfs.makeTmpFile({ dir : '/' }).then(function(path) { | ||
console.log(path); | ||
}).done(); | ||
vfs.makeDir('blocks-desktop/i18n/_keyset').then(function() { | ||
console.log('ok'); | ||
}, function(err) { | ||
console.log(err); | ||
}) | ||
vfs.makeDir('blocks-desktop/i18n/_keyset').then(function() { | ||
console.log('ok'); | ||
}, function(err) { | ||
console.log(err); | ||
}) | ||
vfs.makeDir('blocks-desktop/i18n/_keyset').then(function() { | ||
console.log('ok'); | ||
}, function(err) { | ||
console.log(err); | ||
}) | ||
vfs.makeDir('blocks-desktop/i18n/_keyset').then(function() { | ||
console.log('ok'); | ||
}, function(err) { | ||
console.log(err); | ||
}) | ||
vfs.makeDir('blocks-desktop/i18n/_keyset').then(function() { | ||
console.log('ok'); | ||
}, function(err) { | ||
console.log(err); | ||
}) | ||
vfs.makeDir('blocks-desktop/i18n/_keyset').then(function() { | ||
console.log('ok'); | ||
}, function(err) { | ||
console.log(err); | ||
}) | ||
vfs.makeDir('blocks-desktop/i18n/_keyset').then(function() { | ||
console.log('ok'); | ||
}, function(err) { | ||
console.log(err); | ||
}) |
28721
772