0
0
Fork 0
mirror of https://github.com/schollz/croc.git synced 2025-10-11 13:21:00 +02:00

path -> fpath

This commit is contained in:
Zack Scholl 2022-12-05 15:24:47 -08:00
parent 9a8e584aca
commit 07a67ed54e

View file

@ -271,15 +271,15 @@ func GetFilesInfo(fnames []string, zipfolder bool) (filesInfo []FileInfo, emptyF
} }
} }
for _, path := range paths { for _, fpath := range paths {
stat, errStat := os.Lstat(path) stat, errStat := os.Lstat(fpath)
if errStat != nil { if errStat != nil {
err = errStat err = errStat
return return
} }
absPath, errAbs := filepath.Abs(path) absPath, errAbs := filepath.Abs(fpath)
if errAbs != nil { if errAbs != nil {
err = errAbs err = errAbs
@ -287,12 +287,12 @@ func GetFilesInfo(fnames []string, zipfolder bool) (filesInfo []FileInfo, emptyF
} }
if stat.IsDir() && zipfolder { if stat.IsDir() && zipfolder {
if path[len(path)-1:] != "/" { if fpath[len(fpath)-1:] != "/" {
path += "/" fpath += "/"
} }
path = filepath.Dir(path) fpath = filepath.Dir(fpath)
dest := filepath.Base(path) + ".zip" dest := filepath.Base(fpath) + ".zip"
utils.ZipDirectory(dest, path) utils.ZipDirectory(dest, fpath)
stat, errStat = os.Lstat(dest) stat, errStat = os.Lstat(dest)
if errStat != nil { if errStat != nil {
err = errStat err = errStat