diff options
| Commit | e970dc54d59da50d818c013eecfac1c561f5e535 (patch) | |
|---|---|---|
| Author | 2021-09-10 12:31:07 +0300 | |
| Committer | 2021-09-10 12:31:07 +0300 | |
| Files | aeb7d347edd3f0d5d79e2882eea309a886d860af /go-src/utils | |
| ctfc-e970dc54d59da50d818c013eecfac1c561f5e535.tar ctfc-e970dc54d59da50d818c013eecfac1c561f5e535.tar.gz ctfc-e970dc54d59da50d818c013eecfac1c561f5e535.zip | ||
| Parent | 2158b0c231665d1841bbff1dfaaf11d6d45a7b9f (diff) | |
Abstracted some OS file and folder functionality in utils
1 files changed, 14 insertions, 0 deletions
| -rw-r--r-- | go-src/utils/utils.go | 14 |
diff --git a/go-src/utils/utils.go b/go-src/utils/utils.go index 7b7314e..d6fc47c 100644 --- a/go-src/utils/utils.go +++ b/go-src/utils/utils.go @@ -35,6 +35,20 @@ func AppendToFile(path string, value string) { allChatsFile.Close() } +func CreateDir(path string) { + os.Mkdir(path, 0775) +} + +func CreateFile(path string) { + f, _ := os.Create(path) + f.Close() +} + +func PathExists(path string) bool { + _, err := os.Stat(path) + return !os.IsNotExist(err) +} + func StrShortenRight(s *string, amount int) { *s = (*s)[:len(*s)-amount] } |
