importing nherment's patch for issue #7
This commit is contained in:
parent
403deea04c
commit
34de06b73d
1 changed files with 24 additions and 0 deletions
|
|
@ -213,6 +213,30 @@ exports.copyDirRecursive = function copyDirRecursive(srcDir, newDir, clbk) {
|
|||
});
|
||||
};
|
||||
|
||||
var mkDirSyncRecursive = function(path, mode) {
|
||||
var self = this;
|
||||
|
||||
try {
|
||||
fs.mkdirSync(path, mode);
|
||||
} catch(err) {
|
||||
if(err.code == "ENOENT") {
|
||||
var slashIdx = path.lastIndexOf("/");
|
||||
if(slashIdx > 0) {
|
||||
var parentPath = path.substring(0, slashIdx);
|
||||
mkDirSyncRecursive(parentPath, mode);
|
||||
mkDirSyncRecursive(path, mode);
|
||||
} else {
|
||||
throw err;
|
||||
}
|
||||
} else if(err.code == "EEXIST") {
|
||||
return;
|
||||
} else {
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
};
|
||||
exports.mkDirSyncRecursive = mkDirSyncRecursive;
|
||||
|
||||
exports.LineReader = function(filename, bufferSize) {
|
||||
this.bufferSize = bufferSize || 8192;
|
||||
this.buffer = "";
|
||||
|
|
|
|||
Reference in a new issue