Changed Project structure for non Package Project

This commit is contained in:
Pablu23
2024-05-18 14:21:56 +02:00
parent 1bd80bc1c2
commit bf4b4a3a15
5 changed files with 2 additions and 2 deletions

40
release.go Normal file
View File

@@ -0,0 +1,40 @@
//go:build !Develop
package main
import (
"os"
"path/filepath"
)
const port = 8000
func getDbPath() string {
dir, err := os.UserCacheDir()
if err != nil {
panic(err)
}
dirPath := filepath.Join(dir, "MangaGetter")
filePath := filepath.Join(dirPath, "db.sqlite")
if _, err := os.Stat(dirPath); os.IsNotExist(err) {
err = os.Mkdir(dirPath, os.ModePerm)
if err != nil {
panic(err)
}
}
if _, err := os.Stat(filePath); os.IsNotExist(err) {
f, err := os.Create(filePath)
if err != nil {
panic(err)
}
err = f.Close()
if err != nil {
panic(err)
}
}
return filePath
}