Create image folder if it does not exist

This commit is contained in:
2026-03-05 15:45:29 +01:00
parent fea4993d26
commit a24dd794a8
2 changed files with 18 additions and 1 deletions

View File

@@ -96,3 +96,14 @@ func computePathFromName(ac *appcontext.AppContext, filename string) string {
func GetWsLinkPrefix() string {
return "/static/bookcover/"
}
func CreateFolderIfMissing(dir string) error {
_, openFileErr := os.Open(dir)
if os.IsNotExist(openFileErr) {
return os.MkdirAll(dir, 0755)
} else if openFileErr != nil {
return openFileErr
} else {
return nil
}
}