Skip to content

Commit

Permalink
Added architecture support
Browse files Browse the repository at this point in the history
  • Loading branch information
coreybutler committed Oct 15, 2014
1 parent 1247130 commit af6827b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
21 changes: 11 additions & 10 deletions src/nvm.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
)

const (
NvmVersion = "1.0.3"
NvmVersion = "1.0.5"
)

type Environment struct {
Expand Down Expand Up @@ -118,7 +118,8 @@ func update() {

func install(version string, cpuarch string) {
if version == "" {
fmt.Println("\nInvalid version.\n")
fmt.Println("\nInvalid version.")
fmt.Println(" ")
help()
return
}
Expand Down Expand Up @@ -278,8 +279,7 @@ func use(version string, cpuarch string) {
}

// Create or update the symlink
sym, serr := os.Stat(env.symlink)
serr = serr
sym, _ := os.Stat(env.symlink)
if sym != nil {
cmd := exec.Command(env.root+"\\elevate.cmd", "cmd", "/C", "rmdir", env.symlink)
var output bytes.Buffer
Expand Down Expand Up @@ -407,8 +407,7 @@ func enable() {
files, _ := ioutil.ReadDir(env.root)
for _, f := range files {
if f.IsDir() {
isnode, verr := regexp.MatchString("v",f.Name())
verr = verr
isnode, _ := regexp.MatchString("v",f.Name())
if isnode {
dir = f.Name()
}
Expand All @@ -429,7 +428,9 @@ func disable() {
}

func help() {
fmt.Println("\nUsage:\n")
fmt.Println("\nnRunning version "+NvmVersion+".")
fmt.Println("\nUsage:")
fmt.Println(" ")
fmt.Println(" nvm arch : Show if node is running in 32 or 64 bit mode.")
fmt.Println(" nvm install <version> [arch] : The version can be a node.js version or \"latest\" for the latest stable version.")
fmt.Println(" Optionally specify whether to install the 32 or 64 bit version (defaults to system arch).")
Expand All @@ -445,7 +446,8 @@ func help() {
fmt.Println(" nvm use <arch> will continue using the selected version, but switch to 32/64 bit mode.")
fmt.Println(" nvm root [path] : Set the directory where nvm should store different versions of node.js.")
fmt.Println(" If <path> is not set, the current root will be displayed.")
fmt.Println(" nvm version : Displays the current running version of nvm for Windows.\n")
fmt.Println(" nvm version : Displays the current running version of nvm for Windows.")
fmt.Println(" ")
}

// Given a node.js version, returns the associated npm version
Expand Down Expand Up @@ -512,10 +514,9 @@ func Setup() {
env.arch = arch.Validate(env.arch)

// Make sure the directories exist
p, e := os.Stat(env.root)
_, e := os.Stat(env.root)
if e != nil {
fmt.Println(env.root+" could not be found or does not exist. Exiting.")
return
p=p
}
}
3 changes: 1 addition & 2 deletions src/nvm/web/web.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ func Download(url string, target string) bool {
}
defer response.Body.Close()

n, err := io.Copy(output, response.Body)
n=n
_, err = io.Copy(output, response.Body)
if err != nil {
fmt.Println("Error while downloading", url, "-", err)
}
Expand Down

0 comments on commit af6827b

Please sign in to comment.