remove warning for external storage target

since temporary files are now encrypted so no longer matters
This commit is contained in:
Evan Su 2025-04-13 13:32:56 -04:00
parent 159944a619
commit 757c9c23e4

View file

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