Skip to content

Commit

Permalink
Merge pull request #828 from tgerring/pathfixes
Browse files Browse the repository at this point in the history
Remove path separator literals
  • Loading branch information
obscuren committed Apr 29, 2015
2 parents a6a49cc + f8cdff9 commit 32373e3
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions common/path.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@ func MakeName(name, version string) string {

func ExpandHomePath(p string) (path string) {
path = p
sep := fmt.Sprintf("%s", os.PathSeparator)

// Check in case of paths like "/something/~/something/"
if len(path) > 1 && path[:2] == "~/" {
if len(p) > 1 && p[:1+len(sep)] == "~"+sep {
usr, _ := user.Current()
dir := usr.HomeDir

Expand Down Expand Up @@ -64,11 +65,11 @@ func DefaultAssetPath() string {
case "darwin":
// Get Binary Directory
exedir, _ := osext.ExecutableFolder()
assetPath = filepath.Join(exedir, "../Resources")
assetPath = filepath.Join(exedir, "..", "Resources")
case "linux":
assetPath = "/usr/share/mist"
assetPath = path.Join("usr", "share", "mist")
case "windows":
assetPath = "./assets"
assetPath = path.Join(".", "assets")
default:
assetPath = "."
}
Expand All @@ -86,9 +87,9 @@ func DefaultAssetPath() string {
func DefaultDataDir() string {
usr, _ := user.Current()
if runtime.GOOS == "darwin" {
return path.Join(usr.HomeDir, "Library/Ethereum")
return path.Join(usr.HomeDir, "Library", "Ethereum")
} else if runtime.GOOS == "windows" {
return path.Join(usr.HomeDir, "AppData/Roaming/Ethereum")
return path.Join(usr.HomeDir, "AppData", "Roaming", "Ethereum")
} else {
return path.Join(usr.HomeDir, ".ethereum")
}
Expand Down

0 comments on commit 32373e3

Please sign in to comment.