diff --git a/common/step_download.go b/common/step_download.go index 4351e29c2..e562b619c 100644 --- a/common/step_download.go +++ b/common/step_download.go @@ -7,6 +7,7 @@ import ( "fmt" "log" "os" + "runtime" "strings" "github.com/gofrs/flock" @@ -88,6 +89,21 @@ func (s *StepDownload) Run(ctx context.Context, state multistep.StateBag) multis return multistep.ActionHalt } +var ( + getters = getter.Getters +) + +func init() { + if runtime.GOOS == "windows" { + getters["file"] = &getter.FileGetter{ + // always copy local files instead of symlinking to fix GH-7534. The + // longer term fix for this would be to change the go-getter so that it + // can leave the source file where it is & tell us where it is. + Copy: true, + } + } +} + func (s *StepDownload) download(ctx context.Context, ui packer.Ui, source string) (string, error) { u, err := urlhelper.Parse(source) if err != nil { @@ -152,6 +168,7 @@ func (s *StepDownload) download(ctx context.Context, ui packer.Ui, source string ProgressListener: ui, Pwd: wd, Dir: false, + Getters: getters, } switch err := gc.Get(); err.(type) {