Skip to content
This repository has been archived by the owner on Mar 5, 2022. It is now read-only.

Commit

Permalink
Use filepath, not path, for OS compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
spenczar committed Mar 21, 2017
1 parent 35894df commit 06a574d
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 8 deletions.
3 changes: 1 addition & 2 deletions clean.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"fmt"
"go/build"
"os"
"path"
"path/filepath"
"strings"
)
Expand Down Expand Up @@ -41,7 +40,7 @@ func clean(pkgs []string) {

resolve("", pkgs)

base := path.Join(toolDirPath, "src")
base := filepath.Join(toolDirPath, "src")

// Resolve any symlinks in the packages to keep, because we're going
// to walk through the file system, so we need to trim stuff by
Expand Down
4 changes: 2 additions & 2 deletions do.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ package main
import (
"os"
"os/exec"
"path"
"path/filepath"
"strings"
)

func setPath() (unset func()) {
prevpath := os.Getenv("PATH")
newPath := path.Join(toolDirPath, "bin") + ":" + prevpath
newPath := filepath.Join(toolDirPath, "bin") + string(os.PathListSeparator) + prevpath
_ = os.Setenv("PATH", newPath)
return func() {
_ = os.Setenv("PATH", prevpath)
Expand Down
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"path/filepath"
)

const version = "v1.0.1"
const version = "v1.0.3"

var cacheDir = ""

Expand Down
5 changes: 2 additions & 3 deletions tool.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"fmt"
"os"
"os/exec"
"path"
"path/filepath"
"strings"

Expand All @@ -19,11 +18,11 @@ type tool struct {
}

func (t *tool) path() string {
return path.Join(cacheDir, "src", t.Repository)
return filepath.Join(cacheDir, "src", t.Repository)
}

func (t *tool) executable() string {
return path.Base(t.Repository)
return filepath.Base(t.Repository)
}

func setEnvVar(cmd *exec.Cmd, key, val string) {
Expand Down

0 comments on commit 06a574d

Please sign in to comment.