From 428a95450c353ef7e47a963eba72650d791b48ed Mon Sep 17 00:00:00 2001 From: Tovi Jaeschke-Rogers Date: Thu, 17 Feb 2022 13:45:00 +1030 Subject: [PATCH] Fix bug with ROOTDIR always showing fs diff --- Client/Filesystem/FilesystemDiff.go | 1 - Client/Filesystem/ManageFileBucket.go | 4 ++-- Client/Package/CreatePackage.go | 7 ++----- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/Client/Filesystem/FilesystemDiff.go b/Client/Filesystem/FilesystemDiff.go index 242586d..a7f1e61 100644 --- a/Client/Filesystem/FilesystemDiff.go +++ b/Client/Filesystem/FilesystemDiff.go @@ -198,7 +198,6 @@ func GetFilesystemDiff(root string) (FilesystemStatus, error) { indexBucket = tx.Bucket(Variables.FsHashIndexBucket) filepath.Walk(root, func(p string, i os.FileInfo, _ error) error { - // Ignore path in Variables.PruneRegexPaths if i.IsDir() && matchAny(p, PruneRegex) { return filepath.SkipDir diff --git a/Client/Filesystem/ManageFileBucket.go b/Client/Filesystem/ManageFileBucket.go index d8f1714..1be9566 100644 --- a/Client/Filesystem/ManageFileBucket.go +++ b/Client/Filesystem/ManageFileBucket.go @@ -20,9 +20,9 @@ func AddFileToBucket(bucket *bolt.Bucket, filePath string) error { return err } - return bucket.Put([]byte(StripRootDir(filePath)), fileObjectBytes) + return bucket.Put([]byte(filePath), fileObjectBytes) } func RemoveFileFromBucket(bucket *bolt.Bucket, filePath string) error { - return bucket.Delete([]byte(StripRootDir(filePath))) + return bucket.Delete([]byte(filePath)) } diff --git a/Client/Package/CreatePackage.go b/Client/Package/CreatePackage.go index 4c2f3a2..471ec57 100644 --- a/Client/Package/CreatePackage.go +++ b/Client/Package/CreatePackage.go @@ -62,7 +62,6 @@ func CreatePackage() error { pkgName string pkgVersion string pkgNameVersion string - pkg string index int err error ) @@ -90,9 +89,7 @@ func CreatePackage() error { choices = Helper.Input() if choices == "" { - for _, pkg = range pickedFiles { - pkgFiles = append(pkgFiles, filepath.Join(Variables.RootDir, pkg)) - } + pkgFiles = append(pkgFiles, pickedFiles...) } else { choicesSplit = strings.Split(choices, ",") @@ -104,7 +101,7 @@ func CreatePackage() error { if len(pickedFiles) < index { return errors.New("invalid choice") } - pkgFiles = append(pkgFiles, filepath.Join(Variables.RootDir, pickedFiles[index])) + pkgFiles = append(pkgFiles, pickedFiles[index]) } }