From d1c3413a0e1237be0193e9bc3e8651f2390f6b0a Mon Sep 17 00:00:00 2001
From: early <me@earlybird.gay>
Date: Tue, 22 Oct 2024 23:02:05 -0600
Subject: [PATCH] Make app.Static's rootDir relative to be more aligned with
 other file include stuff

---
 app/app.go | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/app/app.go b/app/app.go
index 41d98c3..ccf1b75 100644
--- a/app/app.go
+++ b/app/app.go
@@ -12,6 +12,7 @@ import (
 	"os"
 	"path"
 	"path/filepath"
+	"runtime"
 	"slices"
 	"strings"
 	"sync"
@@ -184,6 +185,10 @@ func (app *App) Static(rootPath, rootDir string) error {
 	if app.static == nil {
 		app.static = make(map[string]http.Handler)
 	}
+	_, relativeTo, _, _ := runtime.Caller(1)
+	if !path.IsAbs(rootDir) {
+		rootDir = path.Join(path.Dir(relativeTo), rootDir)
+	}
 	var f func(fpath string) error
 	f = func(fpath string) error {
 		stat, err := os.Stat(fpath)
-- 
2.39.5