1
0
mirror of https://github.com/schollz/cowyo.git synced 2023-08-10 21:13:00 +03:00

Reorganize and add migration

Former-commit-id: 807d525f11b5306c2a4a2e7097a8d92d026fc9df [formerly 9c40fcf478e90dd062c9a173b4d563a4ba15b8bc] [formerly 0c56b23e0782fe14717c243d149983185fe9ad2d [formerly 7f4acdda9a]]
Former-commit-id: 71ae3d9712ec1b7203e6483ad586aeef319fba08 [formerly e633558e9a7491044e324ceeb2cb699b2130f1c8]
Former-commit-id: 8e483f94bf5c75d62d00219085d1e68c4e5683c7
This commit is contained in:
Zack Scholl
2017-03-21 21:51:52 -06:00
parent 97edbd73a8
commit 8a7803250f
5 changed files with 282 additions and 174 deletions

View File

@ -7,6 +7,7 @@ import (
"io/ioutil"
"math/rand"
"net"
"os"
"strings"
"time"
@ -201,3 +202,15 @@ func DecryptString(toDecrypt string, password string) (string, error) {
bDecrypted, err := cryptopasta.Decrypt(contentData, &key)
return string(bDecrypted), err
}
// exists returns whether the given file or directory exists or not
func exists(path string) bool {
_, err := os.Stat(path)
if err == nil {
return true
}
if os.IsNotExist(err) {
return false
}
return true
}