buidler/virtualbox,vmware: only stat if not force

/cc @jasonberanek - Swapped this because why even bother doing a stat
if we're forcing anyways.
This commit is contained in:
Mitchell Hashimoto 2013-07-13 14:47:08 +09:00
parent 276428a330
commit 245deaf599
3 changed files with 11 additions and 7 deletions

View File

@ -219,9 +219,11 @@ func (b *Builder) Prepare(raws ...interface{}) error {
}
}
if _, err := os.Stat(b.config.OutputDir); err == nil {
if !b.config.PackerForce {
errs = append(errs, errors.New("Output directory already exists. It must not exist."))
if _, err := os.Stat(b.config.OutputDir); err == nil {
errs = append(
errs,
errors.New("Output directory already exists. It must not exist."))
}
}

View File

@ -175,9 +175,11 @@ func (b *Builder) Prepare(raws ...interface{}) error {
}
}
if _, err := os.Stat(b.config.OutputDir); err == nil {
if !b.config.PackerForce {
errs = append(errs, errors.New("Output directory already exists. It must not exist."))
if _, err := os.Stat(b.config.OutputDir); err == nil {
errs = append(
errs,
errors.New("Output directory already exists. It must not exist."))
}
}