From 46f74d8347bb49ac1b1ed72e497e006aaa0ae96b Mon Sep 17 00:00:00 2001 From: Rickard von Essen Date: Sun, 21 Feb 2016 16:52:44 +0100 Subject: [PATCH] Parallels: Support relative paths in output_directory Fixes #3238 --- builder/parallels/common/output_config.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/builder/parallels/common/output_config.go b/builder/parallels/common/output_config.go index f3427183c..2b7c7c94c 100644 --- a/builder/parallels/common/output_config.go +++ b/builder/parallels/common/output_config.go @@ -3,6 +3,7 @@ package common import ( "fmt" "os" + "path" "github.com/mitchellh/packer/common" "github.com/mitchellh/packer/template/interpolate" @@ -18,6 +19,17 @@ func (c *OutputConfig) Prepare(ctx *interpolate.Context, pc *common.PackerConfig } var errs []error + + if path.IsAbs(c.OutputDir) { + c.OutputDir = path.Clean(c.OutputDir) + } else { + wd, err := os.Getwd() + if err != nil { + errs = append(errs, err) + } + c.OutputDir = path.Clean(path.Join(wd, c.OutputDir)) + } + if !pc.PackerForce { if _, err := os.Stat(c.OutputDir); err == nil { errs = append(errs, fmt.Errorf(