fix basename being . when it is empty (#1525)
* fix basename being `.` when it is empty * remove unnecessary call of `filepath.Base`
This commit is contained in:
1 parent
cbdae8e7f3
commit
31f4a4e16f
2 files changed
+2
-2
No files matched your search
@@ -110,7 +110,7 @@ func copyAll(srcs []string, dstDir string, preserve []string) (nums chan int64,
|
||||
_, err := os.Lstat(dst)
|
||||
if !os.IsNotExist(err) {
|
||||
ext := filepath.Ext(file)
|
||||
basename := filepath.Base(file[:len(file)-len(ext)])
|
||||
basename := file[:len(file)-len(ext)]
|
||||
var newPath string
|
||||
for i := 1; !os.IsNotExist(err); i++ {
|
||||
file = strings.ReplaceAll(gOpts.dupfilefmt, "%f", basename+ext)
|
||||
|
||||
Reference in new issue
Block a user