Skip to content

Commit

Permalink
fix homedir across all OSs
Browse files Browse the repository at this point in the history
  • Loading branch information
vrongmeal committed Dec 14, 2018
1 parent 3a9844b commit c127f44
Show file tree
Hide file tree
Showing 8 changed files with 205 additions and 12 deletions.
1 change: 1 addition & 0 deletions go.mod
Expand Up @@ -2,6 +2,7 @@ module github.com/sdslabs/broCLI

require (
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/mitchellh/go-homedir v1.0.0
github.com/shiena/ansicolor v0.0.0-20151119151921-a422bbe96644
github.com/spf13/cobra v0.0.3
github.com/spf13/pflag v1.0.3 // indirect
Expand Down
2 changes: 2 additions & 0 deletions go.sum
@@ -1,5 +1,7 @@
github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM=
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
github.com/mitchellh/go-homedir v1.0.0 h1:vKb8ShqSby24Yrqr/yDYkuFz8d0WUjys40rvnGC8aR0=
github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
github.com/shiena/ansicolor v0.0.0-20151119151921-a422bbe96644 h1:X+yvsM2yrEktyI+b2qND5gpH8YhURn0k8OCaeRnkINo=
github.com/shiena/ansicolor v0.0.0-20151119151921-a422bbe96644/go.mod h1:nkxAfR/5quYxwPZhyDxgasBMnRtBZd0FCEpawpjMUFg=
github.com/spf13/cobra v0.0.3 h1:ZlrZ4XsMRm04Fr5pSFxBgfND2EBVa1nLpiy1stUsX/8=
Expand Down
19 changes: 7 additions & 12 deletions utils/const.go
@@ -1,21 +1,16 @@
package utils

import (
"os"
"path/filepath"
"runtime"
)

func getHomePath() string {
osys := runtime.GOOS
if osys == "windows" {
return os.Getenv("HOMEPATH")
}
return os.Getenv("HOME")
}
homedir "github.com/mitchellh/go-homedir"
)

// BroConfPath is the path of config file storing Gamepath
var BroConfPath = filepath.Join(getHomePath(), ".brocli")
// Path to config
var (
home, _ = homedir.Dir()
BroConfPath = filepath.Join(home, ".brocli")
)

// Constants
const (
Expand Down
21 changes: 21 additions & 0 deletions vendor/github.com/mitchellh/go-homedir/LICENSE

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions vendor/github.com/mitchellh/go-homedir/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions vendor/github.com/mitchellh/go-homedir/go.mod

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

157 changes: 157 additions & 0 deletions vendor/github.com/mitchellh/go-homedir/homedir.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions vendor/modules.txt
@@ -1,5 +1,7 @@
# github.com/inconshreveable/mousetrap v1.0.0
github.com/inconshreveable/mousetrap
# github.com/mitchellh/go-homedir v1.0.0
github.com/mitchellh/go-homedir
# github.com/shiena/ansicolor v0.0.0-20151119151921-a422bbe96644
github.com/shiena/ansicolor
# github.com/spf13/cobra v0.0.3
Expand Down

0 comments on commit c127f44

Please sign in to comment.