mirror of
https://github.com/Picocrypt/CLI.git
synced 2026-03-11 14:44:23 +00:00
do a scan for possibly missed temp zip files and del
if they exist
This commit is contained in:
parent
c8b25c04a2
commit
95ee00dd6b
1 changed files with 13 additions and 2 deletions
|
|
@ -185,7 +185,7 @@ func compress() int {
|
|||
return 1
|
||||
}
|
||||
dir = filepath.ToSlash(dir)
|
||||
file, err = os.CreateTemp("", "picocrypt-cli-v2-*.tmp")
|
||||
file, err = os.CreateTemp("", "picocrypt-cli-v2-*.zip.tmp")
|
||||
if err != nil {
|
||||
fmt.Println("Cannot create temporary file!")
|
||||
return 1
|
||||
|
|
@ -193,6 +193,8 @@ func compress() int {
|
|||
pzip = file.Name()
|
||||
writer = zip.NewWriter(file)
|
||||
|
||||
fmt.Println("Info: creating temporary zip file " + pzip)
|
||||
|
||||
for i, path := range files {
|
||||
stat, err := os.Stat(path)
|
||||
if err != nil {
|
||||
|
|
@ -344,7 +346,7 @@ func work() int {
|
|||
hkdfSalt = make([]byte, 32)
|
||||
serpentIV = make([]byte, 16)
|
||||
nonce = make([]byte, 24)
|
||||
_, errs[0] = fout.Write(rsEncode(rs5, []byte("v1.46")))
|
||||
_, errs[0] = fout.Write(rsEncode(rs5, []byte("v1.48")))
|
||||
_, errs[1] = fout.Write(rsEncode(rs5, []byte("00000")))
|
||||
flags := make([]byte, 5)
|
||||
if *p {
|
||||
|
|
@ -685,4 +687,13 @@ func main() {
|
|||
}
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
td := os.TempDir()
|
||||
matches, err := filepath.Glob(filepath.Join(td, "picocrypt-cli-v2-*.zip.tmp"))
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
for _, v := range matches {
|
||||
os.Remove(v)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue