diff options
Diffstat (limited to 'model')
-rw-r--r-- | model/storage.go | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/model/storage.go b/model/storage.go index 39539d4..2ce2fdf 100644 --- a/model/storage.go +++ b/model/storage.go @@ -3,11 +3,12 @@ package model import ( "log" "os" + "path/filepath" ) var storage string -func InitStorage() { +func InitStorage(version string) { var err error storage, err = os.MkdirTemp("", "ceres-") @@ -15,6 +16,14 @@ func InitStorage() { log.Fatal(err) } + if version != "" { + vp := filepath.Join(storage, "version.txt") + err = os.WriteFile(vp, []byte(version+"\n"), 0644) + if err != nil { + log.Fatal(err) + } + } + log.Printf("Storage directory: %s\n", storage) } |