package model import ( "log" "os" "path/filepath" ) var storage string func InitStorage(version string) { var err error storage, err = os.MkdirTemp("", "ceres-") if err != nil { 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) } 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") } }