Rename app to radiantwave: embed and provision assets, drop proclamations

This commit is contained in:
NeilClack
2026-08-03 01:54:27 -05:00
parent 2e700212b9
commit 11b25227d7
74 changed files with 178 additions and 7566 deletions
+19 -2
View File
@@ -2,6 +2,7 @@ package application
import (
"errors"
"io/fs"
"os"
"path/filepath"
"time"
@@ -10,6 +11,7 @@ import (
"github.com/veandco/go-sdl2/sdl"
"github.com/veandco/go-sdl2/ttf"
"gorm.io/gorm"
"rhemawavetech.com/rhemawave/internal/assets"
"rhemawavetech.com/rhemawave/internal/db"
"rhemawavetech.com/rhemawave/internal/download"
"rhemawavetech.com/rhemawave/internal/fontManager"
@@ -59,11 +61,16 @@ type Application struct {
var lastNetworkCheckTime time.Time
var networkIsUp bool
// DataDirFor returns the per-user data directory for the application.
func DataDirFor(homeDir string) string {
return filepath.Join(homeDir, ".local", "share", "radiantwave")
}
// ----------------------------------------------------------------------------
// Main Entry Point
// ----------------------------------------------------------------------------
func Run() {
func Run(bundled fs.FS) {
var err error
var homeDir string
var dataDir string
@@ -79,7 +86,7 @@ func Run() {
return
}
dataDir = filepath.Join(homeDir, ".local", "share", "rhemawave")
dataDir = DataDirFor(homeDir)
if err := os.MkdirAll(dataDir, 0755); err != nil {
logger.Error("unable to create data directory %s %v", dataDir, err)
return
@@ -137,6 +144,16 @@ func Run() {
logger.AddDatabase(DB)
// Ensure bundled static assets (fonts, shaders, tos) are present in the
// assets directory before any manager tries to load them.
config, err := db.GetConfig(DB)
if err != nil {
panic(err)
}
if err := assets.Provision(bundled, config.AssetsDir); err != nil {
logger.Error("failed to provision bundled assets into %s: %v", config.AssetsDir, err)
}
app := &Application{
DB: DB,
}
+10
View File
@@ -445,6 +445,16 @@ func TestMultipleComputeStateCallsAfterDownloadComplete(t *testing.T) {
}
}
// TestDataDirFor verifies the per-user data directory resolves to the
// radiantwave path, not the legacy rhemawave name.
func TestDataDirFor(t *testing.T) {
got := DataDirFor("/home/kiosk")
want := "/home/kiosk/.local/share/radiantwave"
if got != want {
t.Errorf("DataDirFor(/home/kiosk) = %q, want %q", got, want)
}
}
func setupTestDB(t *testing.T) *gorm.DB {
t.Helper()
d, err := db.Connect(":memory:")