email_test: allow running with INTERNAL=on

This commit is contained in:
Harvey Tindall
2025-08-31 17:39:08 +01:00
parent febbe27a0d
commit 87c0f54a8d
8 changed files with 43 additions and 30 deletions
+10 -6
View File
@@ -4,10 +4,11 @@
package main
import (
"log"
"os"
"path/filepath"
"strings"
"github.com/hrfee/jfa-go/logger"
)
const binaryType = "external"
@@ -28,9 +29,12 @@ func FSJoin(elem ...string) string {
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"))
func loadFilesystems(rootDir string, logger *logger.Logger) {
logger.Println("Using external storage")
if rootDir == "" {
executable, _ := os.Executable()
rootDir = filepath.Dir(executable)
}
localFS = dirFS(filepath.Join(rootDir, "data"))
langFS = dirFS(filepath.Join(rootDir, "data", "lang"))
}