Skip to content

Commit

Permalink
Merge pull request #794 from electron-userland/overwrite-with-default…
Browse files Browse the repository at this point in the history
…-platform-arch

Fix overwrite when default platform/arch are used
  • Loading branch information
malept committed Jan 26, 2018
2 parents 5c0113d + 7098a70 commit b95b146
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
3 changes: 2 additions & 1 deletion index.js
Expand Up @@ -63,6 +63,7 @@ class Packager {
}

overwriteAndCreateApp (outDir, comboOpts, zipPath) {
debug(`Removing ${outDir} due to setting overwrite: true`)
return fs.remove(outDir)
.then(() => this.createApp(comboOpts, zipPath))
}
Expand Down Expand Up @@ -94,7 +95,7 @@ class Packager {
}

checkOverwrite (comboOpts, zipPath) {
const finalPath = common.generateFinalPath(this.opts)
const finalPath = common.generateFinalPath(comboOpts)
return fs.pathExists(finalPath)
.then(exists => {
if (exists) {
Expand Down
15 changes: 15 additions & 0 deletions test/basic.js
Expand Up @@ -195,6 +195,21 @@ util.testSinglePlatform('overwrite test', (t, opts) => {
.then(exists => t.false(exists, 'The output directory should be regenerated when overwrite is true'))
})

util.testSinglePlatform('overwrite test sans platform/arch set', (t, opts) => {
delete opts.platfrom
delete opts.arch
opts.dir = util.fixtureSubdir('basic')
opts.overwrite = true

return packager(opts)
.then(paths => fs.pathExists(paths[0]))
.then(exists => {
t.true(exists, 'The output directory exists')
return packager(opts)
}).then(paths => fs.pathExists(paths[0]))
.then(exists => t.true(exists, 'The output directory exists'))
})

util.testSinglePlatform('tmpdir test', (t, opts) => {
opts.name = 'tmpdirTest'
opts.dir = path.join(__dirname, 'fixtures', 'basic')
Expand Down

0 comments on commit b95b146

Please sign in to comment.