mirror of https://github.com/schollz/croc.git
Added support for sending relative folder
This commit is contained in:
parent
37ae453ff7
commit
b50fe88474
|
@ -286,7 +286,8 @@ func GetFilesInfo(fnames []string, zipfolder bool) (filesInfo []FileInfo, emptyF
|
|||
}
|
||||
|
||||
if stat.IsDir() && zipfolder {
|
||||
dest := path + ".zip"
|
||||
path := filepath.Dir(path)
|
||||
dest := filepath.Base(path) + ".zip"
|
||||
utils.ZipDirectory(dest, path)
|
||||
stat, errStat = os.Lstat(dest)
|
||||
if errStat != nil {
|
||||
|
|
|
@ -394,7 +394,8 @@ func ZipDirectory(destination string, source string) (err error) {
|
|||
log.Fatalln(err)
|
||||
}
|
||||
defer f1.Close()
|
||||
w1, err := writer.Create(path)
|
||||
zip_path := strings.ReplaceAll(path, source, strings.TrimSuffix(destination, ".zip"))
|
||||
w1, err := writer.Create(zip_path)
|
||||
if err != nil {
|
||||
log.Fatalln(err)
|
||||
}
|
||||
|
@ -402,7 +403,7 @@ func ZipDirectory(destination string, source string) (err error) {
|
|||
log.Fatalln(err)
|
||||
}
|
||||
fmt.Fprintf(os.Stderr, "\r\033[2K")
|
||||
fmt.Fprintf(os.Stderr, "\rAdding %s", path)
|
||||
fmt.Fprintf(os.Stderr, "\rAdding %s", zip_path)
|
||||
}
|
||||
return nil
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue