From: Sergey Matveev Date: Mon, 14 Dec 2020 18:44:04 +0000 (+0300) Subject: Symlinks -cleanup friendliness X-Git-Tag: v0.5.0~1 X-Git-Url: http://www.git.cypherpunks.ru/?p=goredo.git;a=commitdiff_plain;h=448a8aebeac3a5c411a500f65941bb3c3f90758a Symlinks -cleanup friendliness --- diff --git a/cleanup.go b/cleanup.go index bb9564c..30f1496 100644 --- a/cleanup.go +++ b/cleanup.go @@ -22,6 +22,7 @@ import ( "io" "log" "os" + "path" "path/filepath" "strings" ) @@ -93,13 +94,13 @@ func cleanupWalker(root, what string) error { } return err } - var pth string for _, fi := range fis { - pth = cwdMustRel(root, fi.Name()) + pth := path.Join(root, fi.Name()) + pthRel := cwdMustRel(root, fi.Name()) if fi.IsDir() { if fi.Name() == RedoDir { if what == CleanupFull { - fmt.Println(pth) + fmt.Println(pthRel) err = os.RemoveAll(pth) } else { err = redoDirClean(pth, what) @@ -114,7 +115,7 @@ func cleanupWalker(root, what string) error { } if (what == CleanupTmp || what == CleanupFull) && strings.HasPrefix(fi.Name(), TmpPrefix) { - fmt.Println(pth) + fmt.Println(pthRel) if err = os.Remove(pth); err != nil { return err }