summaryrefslogtreecommitdiff
path: root/model
diff options
context:
space:
mode:
Diffstat (limited to 'model')
-rw-r--r--model/storage.go28
1 files changed, 28 insertions, 0 deletions
diff --git a/model/storage.go b/model/storage.go
new file mode 100644
index 0000000..39539d4
--- /dev/null
+++ b/model/storage.go
@@ -0,0 +1,28 @@
+package model
+
+import (
+ "log"
+ "os"
+)
+
+var storage string
+
+func InitStorage() {
+ var err error
+
+ storage, err = os.MkdirTemp("", "ceres-")
+ if err != nil {
+ log.Fatal(err)
+ }
+
+ log.Printf("Storage directory: %s\n", storage)
+}
+
+func RemoveStorage() {
+ var err error = os.RemoveAll(storage)
+ if err != nil {
+ log.Printf("Failed to remove temporary storage folder: %v\n", err)
+ } else {
+ log.Println("Removed temporary storage folder")
+ }
+}