diff --git a/src/Picocrypt.go b/src/Picocrypt.go index 57e99dd..2466fd2 100644 --- a/src/Picocrypt.go +++ b/src/Picocrypt.go @@ -30,7 +30,6 @@ import ( "os" "path/filepath" "regexp" - "runtime" "strconv" "strings" "time" @@ -131,9 +130,7 @@ var startLabel = "Start" var mainStatus = "Ready" var mainStatusColor = WHITE var popupStatus string - -var temporaryZip bool -var externalDst bool +var usingTempZip bool // Progress variables var progress float32 @@ -637,7 +634,7 @@ func draw() { giu.Checkbox("Paranoid mode", ¶noid), giu.Tooltip("Provides the highest level of security attainable"), giu.Dummy(-170, 0), - giu.Style().SetDisabled(recursively).To( + giu.Style().SetDisabled(recursively || !(len(allFiles) > 1 || len(onlyFolders) > 0)).To( giu.Checkbox("Compress files", &compress).OnChange(func() { if !(len(allFiles) > 1 || len(onlyFolders) > 0) { if compress { @@ -767,21 +764,6 @@ func draw() { } else { file += filepath.Ext(inputFile) + ".pcv" } - externalDst = false - GOOS := strings.ToLower(runtime.GOOS) - if strings.HasPrefix(GOOS, "windows") { - if !strings.HasPrefix(file, "C:") { - externalDst = true - } - } else if strings.HasPrefix(GOOS, "linux") { - if strings.Contains(file, "/media/") || strings.Contains(file, "/mnt/") { - externalDst = true - } - } else if strings.HasPrefix(GOOS, "darwin") { - if strings.Contains(file, "/Volumes/") { - externalDst = true - } - } } else { if strings.HasSuffix(inputFile, ".zip.pcv") { file += ".zip" @@ -814,18 +796,10 @@ func draw() { ).Build() return } - if temporaryZip && externalDst { - giu.Style().SetColor(giu.StyleColorText, YELLOW).To( - giu.Label("Warning: unencrypted temp files will be created"), - ).Build() - } else if temporaryZip { + if usingTempZip { giu.Style().SetColor(giu.StyleColorText, WHITE).To( giu.Label("Ready (info: will create a temporary zip file)"), ).Build() - } else if externalDst { - giu.Style().SetColor(giu.StyleColorText, WHITE).To( - giu.Label("Ready (info: target may be an external drive)"), - ).Build() } else { giu.Style().SetColor(giu.StyleColorText, mainStatusColor).To( giu.Label("Ready"), @@ -1068,7 +1042,7 @@ func onDrop(names []string) { // Set the input and output paths inputFile = filepath.Join(filepath.Dir(names[0]), "Encrypted") + ".zip" outputFile = inputFile + ".pcv" - temporaryZip = true + usingTempZip = true } // Recursively add all files in 'onlyFolders' to 'allFiles' @@ -2357,8 +2331,7 @@ func resetUI() { mainStatus = "Ready" mainStatusColor = WHITE popupStatus = "" - temporaryZip = false - externalDst = false + usingTempZip = false progress = 0 progressInfo = ""