Skip to content

Commit 1df4cc8

Browse files
committed
fix pathing bugs present on windows
1 parent 474df30 commit 1df4cc8

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ jobs:
1919
- make testacc
2020
- os: windows
2121
script:
22+
# TODO: ensure windows setup can support binary testing
2223
- TF_ACC=1 go test -v ./...
2324
env:
2425
- GO111MODULE=on GOFLAGS=-mod=vendor

archive/data_source_archive_file_test.go

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package archive
33
import (
44
"fmt"
55
"os"
6+
"path/filepath"
67
"regexp"
78
"testing"
89

@@ -58,6 +59,7 @@ func TestAccArchiveFile_Basic(t *testing.T) {
5859
r.TestCheckResourceAttrPtr("data.archive_file.foo", "output_size", &fileSize),
5960
),
6061
},
62+
6163
{
6264
Config: testAccArchiveFileMultiConfig,
6365
Check: r.ComposeTestCheckFunc(
@@ -96,7 +98,7 @@ data "archive_file" "foo" {
9698
}
9799
`
98100

99-
var tmpDir = os.TempDir() + "/test"
101+
var tmpDir = filepath.ToSlash(os.TempDir()) + "/test"
100102
var testAccArchiveFileOutputPath = fmt.Sprintf(`
101103
data "archive_file" "foo" {
102104
type = "zip"
@@ -133,10 +135,10 @@ data "archive_file" "foo" {
133135

134136
var testAccArchiveFileMultiConfig = `
135137
data "archive_file" "foo" {
136-
type = "zip"
137-
source {
138-
filename = "content.txt"
139-
content = "This is some content"
138+
type = "zip"
139+
source {
140+
filename = "content.txt"
141+
content = "This is some content"
140142
}
141143
output_path = "zip_file_acc_test.zip"
142144
}

archive/zip_archiver.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,11 @@ func (a *ZipArchiver) ArchiveDir(indirname string, excludes []string) error {
9090
return err
9191
}
9292

93+
// ensure exclusions are OS compatible paths
94+
for i := range excludes {
95+
excludes[i] = filepath.FromSlash(excludes[i])
96+
}
97+
9398
if err := a.open(); err != nil {
9499
return err
95100
}

0 commit comments

Comments
 (0)