Skip to content

Commit

Permalink
Fix compilation output bug that doesn't properly create subdirectorie…
Browse files Browse the repository at this point in the history
…s when running compile with both the -o and -r options.
  • Loading branch information
karthikv committed Nov 24, 2012
1 parent 4a1620f commit 5fdac62
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion commands/compile.js
Expand Up @@ -232,7 +232,7 @@ function generateCompileFn(fileNameSansExtension, extension, compilerOptions,

// consolidate-build will take care of picking which compiler to use;
// simply use the file extension as a key
return utils.mkdirRecursive(directory)
return utils.mkdirRecursive(pathLib.dirname(directory + '/' + fileDisplay))
.then(function() {
return q.ncall(build[extension], build[extension], fileName, options);
})
Expand Down
9 changes: 8 additions & 1 deletion lib/utils.js
Expand Up @@ -219,7 +219,14 @@ exports.mkdirRecursive = function(path) {
var promises = areDirectories.map(function(isDirectory, index) {
// create any directories that don't exist
if (!isDirectory) {
return q.ncall(fs.mkdir, fs, directories[index]);
return q.ncall(fs.mkdir, fs, directories[index])
.fail(function(error) {
// errno 47 means directory already exists, so there is no need
// to throw any error, as what we're trying to do has been done
if (error.errno !== 47) {
throw error;
}
});
}
});

Expand Down

0 comments on commit 5fdac62

Please sign in to comment.