Skip to content

Commit

Permalink
Fixed zip/tgz handling on Windows (#116)
Browse files Browse the repository at this point in the history
  • Loading branch information
shyiko committed Nov 18, 2017
1 parent b22c490 commit d49b443
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions command/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ func untgz(source string, target string, strip bool) error {
dir = filepath.Clean(header.Name)
}
if prefix != nil {
dirSplit := strings.Split(dir, "/")
dirSplit := strings.Split(dir, string(filepath.Separator))
i, e, dse := 0, len(prefix), len(dirSplit)
if dse < e {
e = dse
Expand All @@ -415,10 +415,10 @@ func untgz(source string, target string, strip bool) error {
i++
}
} else {
prefix = strings.Split(dir, "/")
prefix = strings.Split(dir, string(filepath.Separator))
}
}
prefixToStrip = strings.Join(prefix, "/")
prefixToStrip = strings.Join(prefix, string(filepath.Separator))
}
gzFile.Seek(0, 0)
gzr, err := gzip.NewReader(gzFile)
Expand Down Expand Up @@ -493,7 +493,7 @@ func unzip(source string, target string, strip bool) error {
dir = filepath.Clean(f.Name)
}
if prefix != nil {
dirSplit := strings.Split(dir, "/")
dirSplit := strings.Split(dir, string(filepath.Separator))
i, e, dse := 0, len(prefix), len(dirSplit)
if dse < e {
e = dse
Expand All @@ -506,10 +506,10 @@ func unzip(source string, target string, strip bool) error {
i++
}
} else {
prefix = strings.Split(dir, "/")
prefix = strings.Split(dir, string(filepath.Separator))
}
}
prefixToStrip = strings.Join(prefix, "/")
prefixToStrip = strings.Join(prefix, string(filepath.Separator))
}
dirCache := make(map[string]bool) // todo: radix tree would perform better here
//println("mkdir -p " + target)
Expand Down

0 comments on commit d49b443

Please sign in to comment.