Skip to content

Commit e5aacc8

Browse files
try lucky 1
1 parent 3df08f7 commit e5aacc8

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

config/node-utils.go

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import (
55
"fmt"
66
"log"
77
"os"
8-
"path"
98
"path/filepath"
109
"runtime"
1110
)
@@ -30,17 +29,28 @@ func getNodeFileName(nodeRuntime *Runtime) string {
3029
nodeArch = goarch
3130
}
3231

33-
return fmt.Sprintf("node-v%s-%s-%s", nodeRuntime.Version(), goos, nodeArch)
32+
// Map Go OS to Node.js OS name
33+
var nodeOS string
34+
switch goos {
35+
case "windows":
36+
nodeOS = "win"
37+
default:
38+
nodeOS = goos
39+
}
40+
41+
version := nodeRuntime.Version()
42+
43+
return filepath.Join("node-v" + version + "-" + nodeOS + "-" + nodeArch)
3444
}
3545

3646
func genInfoNode(r *Runtime) map[string]string {
3747
nodeFileName := getNodeFileName(r)
3848

3949
return map[string]string{
4050
"nodeFileName": nodeFileName,
41-
"installDir": path.Join(Config.RuntimesDirectory(), nodeFileName),
42-
"node": path.Join(Config.RuntimesDirectory(), nodeFileName, "bin", "node"),
43-
"npm": path.Join(Config.RuntimesDirectory(), nodeFileName, "bin", "npm"),
51+
"installDir": filepath.Join(Config.RuntimesDirectory(), nodeFileName),
52+
"node": filepath.Join(Config.RuntimesDirectory(), nodeFileName, "bin", "node"),
53+
"npm": filepath.Join(Config.RuntimesDirectory(), nodeFileName, "bin", "npm"),
4454
}
4555
}
4656

0 commit comments

Comments
 (0)