]> Cypherpunks.ru repositories - goredo.git/commitdiff
Symlinks -cleanup friendliness
authorSergey Matveev <stargrave@stargrave.org>
Mon, 14 Dec 2020 18:44:04 +0000 (21:44 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Mon, 14 Dec 2020 18:51:16 +0000 (21:51 +0300)
cleanup.go

index bb9564cdc43285bd97472774693771bbd5feef04..30f14964266805d8405f10b8e9780c2eb21bfee2 100644 (file)
@@ -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
                                }