diff options
| author | Syndamia <kamen.d.mladenov@protonmail.com> | 2021-09-10 12:31:07 +0300 |
|---|---|---|
| committer | Syndamia <kamen.d.mladenov@protonmail.com> | 2021-09-10 12:31:07 +0300 |
| commit | e970dc54d59da50d818c013eecfac1c561f5e535 (patch) | |
| tree | aeb7d347edd3f0d5d79e2882eea309a886d860af /go-src/utils/utils.go | |
| parent | 2158b0c231665d1841bbff1dfaaf11d6d45a7b9f (diff) | |
| download | ctfc-e970dc54d59da50d818c013eecfac1c561f5e535.tar ctfc-e970dc54d59da50d818c013eecfac1c561f5e535.tar.gz ctfc-e970dc54d59da50d818c013eecfac1c561f5e535.zip | |
Abstracted some OS file and folder functionality in utils
Diffstat (limited to 'go-src/utils/utils.go')
| -rw-r--r-- | go-src/utils/utils.go | 14 |
1 files changed, 14 insertions, 0 deletions
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] } |
