package model import ( "log" "os" "path/filepath" ) func InitStorage(path string, version string) { err := os.Mkdir(path, 0750) if err != nil && !os.IsExist(err) { log.Fatal(err) } log.Printf("Created storage folder %s\n", path) if version != "" { vp := filepath.Join(path, "version.txt") err = os.WriteFile(vp, []byte(version+"\n"), 0644) if err != nil { log.Fatal(err) } } log.Printf("Storage directory: %s\n", path) }