From 1e1a479b2318df49365eae4b63ede4c59b8ab78f Mon Sep 17 00:00:00 2001 From: Mark Lee Date: Sun, 10 May 2015 15:44:38 -0700 Subject: [PATCH] Ensure the out dir specified exists when building OSX app --- mac.js | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/mac.js b/mac.js index daf11f0..b735f97 100644 --- a/mac.js +++ b/mac.js @@ -98,18 +98,22 @@ function buildMacApp (opts, cb, newApp) { function moveApp () { // finally, move app into cwd - var finalPath = path.join(opts.out || process.cwd(), opts.name + '.app') + var outdir = opts.out || process.cwd() + var finalPath = path.join(outdir, opts.name + '.app') - fs.rename(newApp, finalPath, function moved (err) { + mkdirp(outdir, function mkoutdirp () { if (err) return cb(err) - if (opts.asar) { - asarApp(function (err) { - if (err) return cb(err) + fs.rename(newApp, finalPath, function moved (err) { + if (err) return cb(err) + if (opts.asar) { + asarApp(function (err) { + if (err) return cb(err) + updateMacIcon() + }) + } else { updateMacIcon() - }) - } else { - updateMacIcon() - } + } + }) }) }