fully self-contained

paths are pretty janky, but it works. Also, [files]/lang_files now must
be the path to a directory CONTAINING a "lang/" directory. I'll work
around this at a later date.
This commit is contained in:
Harvey Tindall
2021-02-12 14:28:09 +00:00
parent 0330540f87
commit 815bdc35ac
8 changed files with 43 additions and 65 deletions
+4 -2
View File
@@ -1,6 +1,7 @@
package main
import (
"fmt"
"io/fs"
"net/http"
"strings"
@@ -14,12 +15,13 @@ type httpFS struct {
}
func (f httpFS) Open(name string) (http.File, error) {
return f.hfs.Open(name)
fmt.Println("build/data/web" + name)
return f.hfs.Open("build/data/web" + name)
}
func (f httpFS) Exists(prefix string, filepath string) bool {
if p := strings.TrimPrefix(filepath, prefix); len(p) < len(filepath) {
stats, err := fs.Stat(f.fs, p)
stats, err := fs.Stat(f.fs, "build/data/web/"+p)
if err != nil {
return false
}