treat windows less differently

This commit is contained in:
AJ ONeal 2019-08-09 23:34:08 -06:00
parent 1c38262641
commit dafc02201f

View File

@ -165,7 +165,22 @@ func main() {
panic(err)
}
strip := 1
err = unzip(z, s.Size(), outdir, strip)
if "windows" == pkg.os {
// re-nest into "bin" for consistency
err = unzip(z, s.Size(), filepath.Join(outdir, "bin"), strip)
// handle the special case of git bash
sh := strings.Join([]string{
`#!/usr/bin/env bash`,
`"$(dirname "$0")/node.exe" "$@"`,
`exit $?`,
}, "\n")
script := filepath.Join(outdir, "bin", "node")
if err := ioutil.WriteFile(script, []byte(sh), 0755); nil != err {
panic(err)
}
} else {
err = unzip(z, s.Size(), outdir, strip)
}
if nil != err {
panic(err)
}