mirror of
https://github.com/hrfee/jfa-go.git
synced 2025-01-22 08:10:10 +00:00
remove embed, oops
This commit is contained in:
parent
d061721f56
commit
173c38563e
35
embed.go
35
embed.go
@ -1,35 +0,0 @@
|
|||||||
package main
|
|
||||||
import (
|
|
||||||
"embed"
|
|
||||||
"io/fs"
|
|
||||||
"log"
|
|
||||||
)
|
|
||||||
|
|
||||||
//go:embed data data/html data/web data/web/css data/web/js
|
|
||||||
var loFS embed.FS
|
|
||||||
|
|
||||||
//go:embed lang/common lang/admin lang/email lang/form lang/setup
|
|
||||||
var laFS embed.FS
|
|
||||||
|
|
||||||
var langFS rewriteFS
|
|
||||||
var localFS rewriteFS
|
|
||||||
|
|
||||||
type rewriteFS struct {
|
|
||||||
fs embed.FS
|
|
||||||
prefix string
|
|
||||||
}
|
|
||||||
|
|
||||||
func (l rewriteFS) Open(name string) (fs.File, error) { return l.fs.Open(l.prefix + name) }
|
|
||||||
func (l rewriteFS) ReadDir(name string) ([]fs.DirEntry, error) { return l.fs.ReadDir(l.prefix + name) }
|
|
||||||
func (l rewriteFS) ReadFile(name string) ([]byte, error) { return l.fs.ReadFile(l.prefix + name) }
|
|
||||||
func FSJoin(elem ...string) string {
|
|
||||||
out := ""
|
|
||||||
for _, v := range elem { out += v + "/" }
|
|
||||||
return out[:len(out)-1]
|
|
||||||
}
|
|
||||||
|
|
||||||
func loadFilesystems() {
|
|
||||||
langFS = rewriteFS{laFS, "lang/"}
|
|
||||||
localFS = rewriteFS{loFS, "data/"}
|
|
||||||
log.Println("Using internal storage")
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user