Permalink
Browse files

Fix compilation output bug that doesn't properly create subdirectorie…

…s when running compile with both the -o and -r options.
  • Loading branch information...
1 parent 4a1620f commit 5fdac624b8bb2e5d3bf114e0e184c2b5a7cdbcd2 @karthikv committed Nov 24, 2012
Showing with 9 additions and 2 deletions.
  1. +1 −1 commands/compile.js
  2. +8 −1 lib/utils.js
View
@@ -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);
})
View
@@ -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;
+ }
+ });
}
});

0 comments on commit 5fdac62

Please sign in to comment.