summaryrefslogtreecommitdiff
path: root/model/storage.go
blob: 39539d431caec74efd82fe64938a15addb9fcbb8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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")
	}
}