From ed5f3b86f588c1749b7252d96eb5e5c466b5f453 Mon Sep 17 00:00:00 2001 From: Gani Georgiev Date: Thu, 15 Sep 2022 22:52:24 +0300 Subject: [PATCH] [#470] don't rely on the cwd and look for pb_public relative to pb_data --- examples/base/main.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/examples/base/main.go b/examples/base/main.go index 04b452be..3e5e2861 100644 --- a/examples/base/main.go +++ b/examples/base/main.go @@ -2,6 +2,7 @@ package main import ( "log" + "path/filepath" "github.com/labstack/echo/v5" "github.com/pocketbase/pocketbase" @@ -14,7 +15,7 @@ func main() { app.OnBeforeServe().Add(func(e *core.ServeEvent) error { // serves static files from the provided public dir (if exists) - subFs := echo.MustSubFS(e.Router.Filesystem, "pb_public") + subFs := echo.MustSubFS(e.Router.Filesystem, filepath.Join(app.DataDir(), "../pb_public")) e.Router.GET("/*", apis.StaticDirectoryHandler(subFs, false)) return nil