Updated build tools. Now supports links to elevate.cmd and elevate.vbs when using nvm root (fixes #381).

This commit is contained in:
Corey Butler
2018-08-29 21:44:05 -05:00
parent b87de53486
commit 72754b3c33
8 changed files with 13 additions and 5 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -202,6 +202,7 @@ func install(version string, cpuarch string) {
fmt.Println("Node.js v"+version+" is not yet released or available.") fmt.Println("Node.js v"+version+" is not yet released or available.")
return return
} }
if cpuarch == "64" && !web.IsNode64bitAvailable(version) { if cpuarch == "64" && !web.IsNode64bitAvailable(version) {
fmt.Println("Node.js v"+version+" is only available in 32-bit.") fmt.Println("Node.js v"+version+" is only available in 32-bit.")
return return
@@ -209,11 +210,9 @@ func install(version string, cpuarch string) {
// Check to see if the version is already installed // Check to see if the version is already installed
if !node.IsVersionInstalled(env.root,version,cpuarch) { if !node.IsVersionInstalled(env.root,version,cpuarch) {
if !node.IsVersionAvailable(version){ if !node.IsVersionAvailable(version){
fmt.Println("Version "+version+" is not available. If you are attempting to download a \"just released\" version,") url := web.GetFullNodeUrl("index.json")
fmt.Println("it may not be recognized by the nvm service yet (updated hourly). If you feel this is in error and") fmt.Println("\nVersion "+version+" is not available.\n\nThe complete list of available versions can be found at " + url)
fmt.Println("you know the version exists, please visit http://github.com/coreybutler/nodedistro and submit a PR.")
return return
} }
@@ -654,9 +653,18 @@ func updateRootDir(path string) {
return return
} }
currentRoot := env.root
env.root = filepath.Clean(path) env.root = filepath.Clean(path)
// Copy command files
os.Link(filepath.Clean(currentRoot + "/elevate.cmd"), filepath.Clean(env.root + "/elevate.cmd"))
os.Link(filepath.Clean(currentRoot + "/elevate.cmd"), filepath.Clean(env.root + "/elevate.vbs"))
saveSettings() saveSettings()
fmt.Println("\nRoot has been set to "+path)
if currentRoot != env.root {
fmt.Println("\nRoot has been changed from " + currentRoot + " to " + path)
}
} }
func runElevated(command string) bool { func runElevated(command string) bool {