From 9fe251922ef4072bc775596ded2d6e3d53ce8462 Mon Sep 17 00:00:00 2001 From: admin Date: Wed, 22 Apr 2026 20:49:10 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20debug=20=E6=A8=A1=E5=BC=8F?= =?UTF-8?q?=E4=B8=8B=E9=9D=99=E6=80=81=E6=96=87=E4=BB=B6=E8=B7=AF=E5=BE=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/app/server.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/server/app/server.go b/server/app/server.go index e9420b359..cd15a63ab 100644 --- a/server/app/server.go +++ b/server/app/server.go @@ -4,6 +4,8 @@ import ( "io/fs" "net/http" "os" + "path/filepath" + "runtime" "next-terminal/server/api" "next-terminal/server/api/worker" @@ -19,7 +21,15 @@ import ( func getFS(useOS bool) fs.FS { if useOS { log.Debug("using live mode") - return os.DirFS("web/build") + _, filename, _, ok := runtime.Caller(0) + if !ok { + panic("failed to get caller info") + } + appDir := filepath.Dir(filename) + baseDir := filepath.Dir(filepath.Dir(appDir)) + webBuildPath := filepath.Join(baseDir, "web", "build") + log.Debug("web build path: " + webBuildPath) + return os.DirFS(webBuildPath) } log.Debug("using embed mode")