azote-backend/initializers/assets.go

26 lines
500 B
Go
Raw Normal View History

package initializers
import (
"log"
"os"
)
2024-02-28 09:13:08 +01:00
var DebugBasePath string = "./assets/"
var ReleaseBasePath string = "/data/assets/"
2024-02-28 09:13:08 +01:00
func CreateAssetsFolder(basePath string) {
2024-02-28 09:13:08 +01:00
if _, err := os.Stat(basePath + "images"); os.IsNotExist(err) {
if err := os.MkdirAll(basePath+"images", os.ModePerm); err != nil {
log.Fatal(err)
}
}
2024-02-28 09:13:08 +01:00
if _, err := os.Stat(basePath + "videos"); os.IsNotExist(err) {
if err := os.MkdirAll(basePath+"videos", os.ModePerm); err != nil {
log.Fatal(err)
}
}
}