fix: update path library (#678)

Using filepath.Join for embed filenames will not respect Windows
filepaths. https://github.com/golang/go/issues/44305

Fix #662
This commit is contained in:
Yuan
2025-06-09 10:00:26 -07:00
committed by GitHub
parent b81fc6aa6c
commit 4998f82852

View File

@@ -17,7 +17,7 @@ package prebuiltconfigs
import (
"embed"
"fmt"
"path/filepath"
"path"
"strings"
)
@@ -66,7 +66,7 @@ func loadPrebuiltToolYAMLs() (map[string][]byte, []string, error) {
for _, entry := range entries {
lowerName := strings.ToLower(entry.Name())
if !entry.IsDir() && (strings.HasSuffix(lowerName, ".yaml")) {
filePathInFS := filepath.Join("tools", entry.Name())
filePathInFS := path.Join("tools", entry.Name())
content, err := prebuiltConfigsFS.ReadFile(filePathInFS)
if err != nil {
errMsg := fmt.Errorf("failed to read a prebuilt tool %w", err)