Skip to content

Commit e9c3509

Browse files
author
Roberto Sora
committed
removed os dependant funcs to mantain best practice in mangling os paths
1 parent 23f8483 commit e9c3509

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

tools/download.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ func removeStringFromSlice(s []string, r string) []string {
377377

378378
func findBaseDir(dirList []string) string {
379379
if len(dirList) == 1 {
380-
return filepath.Dir(dirList[0]) + "/"
380+
return path.Dir(dirList[0]) + "/"
381381
}
382382

383383
// https://github.com/backdrop-ops/contrib/issues/55#issuecomment-73814500
@@ -386,7 +386,7 @@ func findBaseDir(dirList []string) string {
386386
dirList = removeStringFromSlice(dirList, v)
387387
}
388388

389-
commonBaseDir := commonPrefix(os.PathSeparator, dirList)
389+
commonBaseDir := commonPrefix('/', dirList)
390390
if commonBaseDir != "" {
391391
commonBaseDir = commonBaseDir + "/"
392392
}
@@ -411,6 +411,7 @@ func extractZip(log func(msg string) , body []byte, location string) (string, e
411411

412412
for _, f := range r.File {
413413
fullname := filepath.Join(location, strings.Replace(f.Name, basedir, "", -1))
414+
log(fmt.Sprintf("generated fullname %s removing %s from %s", fullname, basedir, f.Name))
414415
if f.FileInfo().IsDir() {
415416
os.MkdirAll(fullname, f.FileInfo().Mode().Perm())
416417
} else {

0 commit comments

Comments
 (0)