0
0
Fork 0
mirror of https://github.com/schollz/croc.git synced 2025-10-11 13:21:00 +02:00

clean up after local file transfer

This commit is contained in:
Zack Scholl 2018-07-01 20:43:02 -07:00
parent 551160d601
commit 0ec32e3f9a
2 changed files with 6 additions and 8 deletions

View file

@ -99,6 +99,10 @@ func (c *Croc) Send(fname string, codePhrase string) (err error) {
ce.isLocal = true
ce.cs.Unlock()
c.cs.Unlock()
defer func() {
// delete croc files
ce.cleanup()
}()
var ri runInfo
ri.err = ce.client(0, channel)
ri.bothConnected = ce.bothConnected

View file

@ -7,18 +7,12 @@ import (
func (c *Croc) cleanup() {
// erase all the croc files and their possible numbers
for i := 0; i < 100; i++ {
for i := 0; i < 16; i++ {
fname := c.crocFile + "." + strconv.Itoa(i)
if !exists(fname) {
break
}
os.Remove(fname)
}
for i := 0; i < 100; i++ {
for i := 0; i < 16; i++ {
fname := c.crocFileEncrypted + "." + strconv.Itoa(i)
if !exists(fname) {
break
}
os.Remove(fname)
}
os.Remove(c.crocFile)