From ca7d927840d0764b6e83fb728531ecd1cfb0a154 Mon Sep 17 00:00:00 2001 From: Gilbert Chen Date: Thu, 21 Nov 2019 14:56:31 -0500 Subject: [PATCH] Use joinPath instead of filepath.Join to generate UNC paths This fix isn't probably necessary since filepath.Join can now produce UNC paths too with the latest versions of go. However, we still want to keep it for consistency. --- src/duplicacy_entry.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/duplicacy_entry.go b/src/duplicacy_entry.go index 3d77415..69a7525 100644 --- a/src/duplicacy_entry.go +++ b/src/duplicacy_entry.go @@ -490,7 +490,8 @@ func ListEntries(top string, path string, fileList *[]*Entry, patterns []string, } if entry.IsLink() { isRegular := false - isRegular, entry.Link, err = Readlink(filepath.Join(top, entry.Path)) + LOG_INFO("debug", "readlink: %s %s", top, entry.Path) + isRegular, entry.Link, err = Readlink(joinPath(top, entry.Path)) if err != nil { LOG_WARN("LIST_LINK", "Failed to read the symlink %s: %v", entry.Path, err) skippedFiles = append(skippedFiles, entry.Path) @@ -500,7 +501,7 @@ func ListEntries(top string, path string, fileList *[]*Entry, patterns []string, if isRegular { entry.Mode ^= uint32(os.ModeSymlink) } else if path == "" && (filepath.IsAbs(entry.Link) || filepath.HasPrefix(entry.Link, `\\`)) && !strings.HasPrefix(entry.Link, normalizedTop) { - stat, err := os.Stat(filepath.Join(top, entry.Path)) + stat, err := os.Stat(joinPath(top, entry.Path)) if err != nil { LOG_WARN("LIST_LINK", "Failed to read the symlink: %v", err) skippedFiles = append(skippedFiles, entry.Path)