Skip to content

Commit

Permalink
Issue #877 Integration: Absolute path starts without separator on Win…
Browse files Browse the repository at this point in the history
…dows
  • Loading branch information
jsliacan authored and cfergeau committed Jan 10, 2020
1 parent 6673ade commit d6b76f1
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions test/integration/crcsuite/prepare.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"io/ioutil"
"os"
"path/filepath"
"runtime"
"strings"

"github.com/code-ready/crc/pkg/download"
Expand Down Expand Up @@ -67,9 +68,14 @@ func CopyFilesToTestDir() {
}

l := strings.Split(cwd, string(filepath.Separator))
dataDirPieces := append([]string{string(filepath.Separator)}, l[:len(l)-3]...)
dataDirPieces = append(dataDirPieces, "testdata")
dataDirPieces := append(l[:len(l)-3], "testdata")
var volume string
if runtime.GOOS == "windows" {
volume = filepath.VolumeName(cwd)
dataDirPieces = dataDirPieces[1:] // drop volume from list of dirs
}
dataDir := filepath.Join(dataDirPieces...)
dataDir = fmt.Sprintf("%s%c%s", volume, filepath.Separator, dataDir) // prepend volume back

files, err := ioutil.ReadDir(dataDir)
if err != nil {
Expand Down

0 comments on commit d6b76f1

Please sign in to comment.