mirror of
https://github.com/hrfee/jfa-go.git
synced 2026-01-18 16:47:42 +01:00
customcontent.go constains a structure with all the custom content, methods for getting display names, subjects, etc., and a list of variables, conditionals, and placeholder values. Tests for constructX methods included in email_test.go, and all jfa-go tests can be run with make INTERNAL=off test.
37 lines
797 B
Go
37 lines
797 B
Go
//go:build external
|
|
// +build external
|
|
|
|
package main
|
|
|
|
import (
|
|
"log"
|
|
"os"
|
|
"path/filepath"
|
|
"strings"
|
|
)
|
|
|
|
const binaryType = "external"
|
|
|
|
func BuildTagsExternal() { buildTags = append(buildTags, "external") }
|
|
|
|
// When using os.DirFS, even on Windows the separator seems to be '/'.
|
|
// func FSJoin(elem ...string) string { return filepath.Join(elem...) }
|
|
func FSJoin(elem ...string) string {
|
|
sep := "/"
|
|
if strings.Contains(elem[0], "\\") {
|
|
sep = "\\"
|
|
}
|
|
path := ""
|
|
for _, el := range elem {
|
|
path += el + sep
|
|
}
|
|
return strings.TrimSuffix(path, sep)
|
|
}
|
|
|
|
func loadFilesystems() {
|
|
log.Println("Using external storage")
|
|
executable, _ := os.Executable()
|
|
localFS = dirFS(filepath.Join(filepath.Dir(executable), "data"))
|
|
langFS = dirFS(filepath.Join(filepath.Dir(executable), "data", "lang"))
|
|
}
|