issue #24200: make sure we have an output directory
authorSteve Hackbarth <stephenhackbarth@gmail.com>
Mon, 11 Aug 2014 19:28:59 +0000 (15:28 -0400)
committerSteve Hackbarth <stephenhackbarth@gmail.com>
Mon, 11 Aug 2014 19:28:59 +0000 (15:28 -0400)
scripts/lib/util/send_to_database.js

index b064e64..939f280 100644 (file)
@@ -12,6 +12,9 @@ regexp:true, undef:true, strict:true, trailing:true, white:true */
 
   var sendToDatabase = function (query, credsClone, options, callback) {
     var filename = path.join(__dirname, "../../output/build_" + credsClone.database + ".sql");
+    if (!fs.existsSync(path.join(__dirname, "../../output"))) {
+      fs.mkdirSync(path.join(__dirname, "../../output"));
+    }
     fs.writeFile(filename, query, function (err) {
       if (err) {
         winston.error("Cannot write query to file");