chore: import Local-Cursor v1.1.8 source snapshot

Includes the current working directory changes. Historical commits and release binaries are excluded to limit Gitea storage.
Source base: d7515973fbfd6dd2001fa156c483455b8081c7cb
This commit is contained in:
FuDie0915
2026-11-10 01:24:28 +08:00
commit db73cf5a39
337 changed files with 147502 additions and 0 deletions

View File

@@ -0,0 +1,39 @@
//go:build windows
package cursor
import (
"os"
"path/filepath"
"strings"
"testing"
)
// 验证:注册表 PATH 中的 fnm\bin(仅含 fnm.exe)能被扩展到实际 node 所在目录。
func TestMergeNodeSearchPathFindsNode(t *testing.T) {
merged, _ := mergeNodeSearchPath()
if _, err := execLookPathIn(merged, "node.exe"); err != nil {
t.Fatalf("node.exe not found in merged PATH: %v", err)
}
}
// execLookPathIn 在给定 PATH 字符串下查找可执行文件。
func execLookPathIn(pathEnv string, file string) (string, error) {
for _, dir := range filepath.SplitList(pathEnv) {
if dir == "" {
continue
}
candidate := filepath.Join(dir, file)
if info, err := os.Stat(candidate); err == nil && !info.IsDir() {
return candidate, nil
}
// .cmd/.bat 等 PATHEXT 场景只处理精确名与 .cmd。
if !strings.HasSuffix(strings.ToLower(file), ".exe") {
cmdCandidate := candidate + ".cmd"
if info, err := os.Stat(cmdCandidate); err == nil && !info.IsDir() {
return cmdCandidate, nil
}
}
}
return "", os.ErrNotExist
}