diff --git a/.gitignore b/.gitignore index 991c9d04..06c2a081 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ main dist/* -packer-plugin-vagrant \ No newline at end of file +packer-plugin-vagrant +packer-plugin-vagrant.exe \ No newline at end of file diff --git a/post-processor/vagrant/libvirt.go b/post-processor/vagrant/libvirt.go index 4a61bdf3..c5e71332 100644 --- a/post-processor/vagrant/libvirt.go +++ b/post-processor/vagrant/libvirt.go @@ -4,7 +4,6 @@ import ( "fmt" "path/filepath" "strconv" - "strings" packersdk "github.com/hashicorp/packer-plugin-sdk/packer" ) @@ -68,7 +67,7 @@ func (p *LibVirtProvider) Process(ui packersdk.Ui, artifact packersdk.Artifact, // Copy the disk image into the temporary directory (as box.img) for _, path := range artifact.Files() { - if strings.HasSuffix(path, "/"+diskName) { + if filepath.Base(path) == diskName { ui.Message(fmt.Sprintf("Copying from artifact: %s", path)) dstPath := filepath.Join(dir, "box.img") if err = CopyContents(dstPath, path); err != nil {