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
3646func 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