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

Sending folders from the root of a drive always goes to the same path on the receiver's end

Fixes #574
This commit is contained in:
Zack Scholl 2024-07-04 05:52:09 -07:00
parent 4c120c4963
commit 232e162f8c

View file

@ -421,8 +421,14 @@ func GetFilesInfo(fnames []string, zipfolder bool, ignoreGit bool) (filesInfo []
if err != nil {
return err
}
remoteFolder := strings.TrimPrefix(filepath.Dir(pathName),
filepath.Dir(absPath)+string(os.PathSeparator))
absPathWithSeparator := filepath.Dir(absPath)
if !strings.HasSuffix(absPathWithSeparator, string(os.PathSeparator)) {
absPathWithSeparator += string(os.PathSeparator)
}
if strings.HasSuffix(absPathWithSeparator, string(os.PathSeparator)+string(os.PathSeparator)) {
absPathWithSeparator = strings.TrimSuffix(absPathWithSeparator, string(os.PathSeparator))
}
remoteFolder := strings.TrimPrefix(filepath.Dir(pathName), absPathWithSeparator)
if !info.IsDir() {
fInfo := FileInfo{
Name: info.Name(),