sabisan/internal/app/assets.go
V fac53d7b85
All checks were successful
Publish / Test, build, and push image (push) Successful in 3m38s
Refactor app and store layout
2026-05-17 00:03:50 +01:00

23 lines
384 B
Go

package app
import (
"os"
"path/filepath"
"runtime"
)
func projectRoot() string {
_, file, _, ok := runtime.Caller(0)
if !ok {
return "."
}
return filepath.Clean(filepath.Join(filepath.Dir(file), "..", ".."))
}
func assetRoot() string {
if _, err := os.Stat(filepath.Join("web", "templates")); err == nil {
return "web"
}
return filepath.Join(projectRoot(), "web")
}