From ee2abd053c15e915f0be9fe19e4e0efc02a661e9 Mon Sep 17 00:00:00 2001 From: Evan Su <48808396+HACKERALERT@users.noreply.github.com> Date: Thu, 17 Apr 2025 23:46:04 -0400 Subject: [PATCH] remove duplicate single folder size counting --- src/Picocrypt.go | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/src/Picocrypt.go b/src/Picocrypt.go index d616ae3..e27631f 100644 --- a/src/Picocrypt.go +++ b/src/Picocrypt.go @@ -803,6 +803,7 @@ func draw() { if recombine { multiplier++ } + fmt.Println(multiplier, requiredFreeSpace) giu.Style().SetColor(giu.StyleColorText, WHITE).To( giu.Label("Ready (ensure " + sizeify(requiredFreeSpace*int64(multiplier)) + " of disk space is free)"), ).Build() @@ -887,11 +888,6 @@ func onDrop(names []string) { onlyFolders = append(onlyFolders, names[0]) inputFile = filepath.Join(filepath.Dir(names[0]), "encrypted-"+strconv.Itoa(int(time.Now().Unix()))) + ".zip" outputFile = inputFile + ".pcv" - size, err := dirSize(names[0]) - if err != nil { - panic(err) - } - requiredFreeSpace = size } else { // A file was dropped files++ requiredFreeSpace = stat.Size() @@ -2571,20 +2567,6 @@ func unpackArchive(zipPath string) error { return nil } -func dirSize(path string) (int64, error) { - var size int64 - err := filepath.Walk(path, func(_ string, info os.FileInfo, err error) error { - if err != nil { - return err - } - if !info.IsDir() { - size += info.Size() - } - return err - }) - return size, err -} - func main() { // Create the main window window = giu.NewMasterWindow("Picocrypt "+version[1:], 318, 507, giu.MasterWindowFlagsNotResizable)