aboutsummaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorTaylor Gerring <taylor.gerring@gmail.com>2015-04-29 13:30:25 +0800
committerTaylor Gerring <taylor.gerring@gmail.com>2015-04-29 13:30:25 +0800
commitf8cdff9a5d32b3fb358fda77aab59779c8914681 (patch)
treeb8e31e15b35d3ddd165481942ac2a27edf943f87 /common
parenta6a49ccbf77616c1b0fd3a9cd708965211bcab6a (diff)
downloaddexon-f8cdff9a5d32b3fb358fda77aab59779c8914681.tar
dexon-f8cdff9a5d32b3fb358fda77aab59779c8914681.tar.gz
dexon-f8cdff9a5d32b3fb358fda77aab59779c8914681.tar.bz2
dexon-f8cdff9a5d32b3fb358fda77aab59779c8914681.tar.lz
dexon-f8cdff9a5d32b3fb358fda77aab59779c8914681.tar.xz
dexon-f8cdff9a5d32b3fb358fda77aab59779c8914681.tar.zst
dexon-f8cdff9a5d32b3fb358fda77aab59779c8914681.zip
Remove path separator literals
Diffstat (limited to 'common')
-rw-r--r--common/path.go13
1 files changed, 7 insertions, 6 deletions
diff --git a/common/path.go b/common/path.go
index a74a0d5bd..f9b0212c1 100644
--- a/common/path.go
+++ b/common/path.go
@@ -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
@@ -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 = "."
}
@@ -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")
}