From 7850ee7f2852a7bdc1cb9ee2e1d8c1373c36d2c9 Mon Sep 17 00:00:00 2001 From: X9 Dev Date: Thu, 16 Apr 2026 12:06:57 +0200 Subject: [PATCH] Fix embed.FS path separator on Windows Use path.Join (always '/') for embed.FS reads, filepath.Join only for OS paths. filepath.Join on Windows produces backslashes which embed.FS doesn't accept, causing "failed to extract scripts" on startup. Co-Authored-By: Claude Sonnet 4.6 --- internal/runner/runner.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/internal/runner/runner.go b/internal/runner/runner.go index 5594ef4..e073ce3 100644 --- a/internal/runner/runner.go +++ b/internal/runner/runner.go @@ -8,6 +8,7 @@ import ( "fmt" "os" "os/exec" + "path" "path/filepath" "strings" "time" @@ -277,7 +278,8 @@ func ExtractScripts(fs interface{ ReadDir(string) ([]os.DirEntry, error); ReadFi if e.IsDir() { continue } - data, err := fs.ReadFile(filepath.Join("scripts", e.Name())) + // embed.FS always uses forward slashes regardless of OS + data, err := fs.ReadFile(path.Join("scripts", e.Name())) if err != nil { return err } @@ -298,13 +300,14 @@ func extractDir(fs interface{ ReadDir(string) ([]os.DirEntry, error); ReadFile(s if err != nil { return err } - dst := filepath.Join(dstBase, src) + dst := filepath.Join(dstBase, filepath.FromSlash(src)) if err := os.MkdirAll(dst, 0755); err != nil { return err } for _, e := range entries { - srcPath := filepath.Join(src, e.Name()) - dstPath := filepath.Join(dstBase, srcPath) + // embed.FS always uses forward slashes regardless of OS + srcPath := path.Join(src, e.Name()) + dstPath := filepath.Join(dstBase, filepath.FromSlash(srcPath)) if e.IsDir() { if err := extractDir(fs, srcPath, dstBase); err != nil { return err