mirror of
https://github.com/Picocrypt/Picocrypt.git
synced 2025-05-12 05:48:30 +02:00
remove duplicate single folder size counting
This commit is contained in:
parent
75c0a017f9
commit
ee2abd053c
1 changed files with 1 additions and 19 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Reference in a new issue