aboutsummaryrefslogtreecommitdiffstats
path: root/common/path.go
diff options
context:
space:
mode:
authorBas van Kervel <basvankervel@ziggo.nl>2015-05-12 20:24:11 +0800
committerBas van Kervel <basvankervel@ziggo.nl>2015-05-12 20:24:11 +0800
commitb79dd188d916da7adbf448dc27b0c59a04e0938d (patch)
tree7980ae848a916171fbc65fb958eebdf0c98406dc /common/path.go
parentd82caa5ce38705d2dcdc2ba15c93df9325504e34 (diff)
downloaddexon-b79dd188d916da7adbf448dc27b0c59a04e0938d.tar.gz
dexon-b79dd188d916da7adbf448dc27b0c59a04e0938d.tar.zst
dexon-b79dd188d916da7adbf448dc27b0c59a04e0938d.zip
replaced several path.* with filepath.* which is platform independent
Diffstat (limited to 'common/path.go')
-rw-r--r--common/path.go21
1 files changed, 10 insertions, 11 deletions
diff --git a/common/path.go b/common/path.go
index f9b0212c1..3468b3366 100644
--- a/common/path.go
+++ b/common/path.go
@@ -4,7 +4,6 @@ import (
"fmt"
"os"
"os/user"
- "path"
"path/filepath"
"runtime"
"strings"
@@ -44,22 +43,22 @@ func FileExist(filePath string) bool {
}
func AbsolutePath(Datadir string, filename string) string {
- if path.IsAbs(filename) {
+ if filepath.IsAbs(filename) {
return filename
}
- return path.Join(Datadir, filename)
+ return filepath.Join(Datadir, filename)
}
func DefaultAssetPath() string {
var assetPath string
pwd, _ := os.Getwd()
- srcdir := path.Join(os.Getenv("GOPATH"), "src", "github.com", "ethereum", "go-ethereum", "cmd", "mist")
+ srcdir := filepath.Join(os.Getenv("GOPATH"), "src", "github.com", "ethereum", "go-ethereum", "cmd", "mist")
// If the current working directory is the go-ethereum dir
// assume a debug build and use the source directory as
// asset directory.
if pwd == srcdir {
- assetPath = path.Join(pwd, "assets")
+ assetPath = filepath.Join(pwd, "assets")
} else {
switch runtime.GOOS {
case "darwin":
@@ -67,9 +66,9 @@ func DefaultAssetPath() string {
exedir, _ := osext.ExecutableFolder()
assetPath = filepath.Join(exedir, "..", "Resources")
case "linux":
- assetPath = path.Join("usr", "share", "mist")
+ assetPath = filepath.Join("usr", "share", "mist")
case "windows":
- assetPath = path.Join(".", "assets")
+ assetPath = filepath.Join(".", "assets")
default:
assetPath = "."
}
@@ -78,7 +77,7 @@ func DefaultAssetPath() string {
// Check if the assetPath exists. If not, try the source directory
// This happens when binary is run from outside cmd/mist directory
if _, err := os.Stat(assetPath); os.IsNotExist(err) {
- assetPath = path.Join(srcdir, "assets")
+ assetPath = filepath.Join(srcdir, "assets")
}
return assetPath
@@ -87,11 +86,11 @@ func DefaultAssetPath() string {
func DefaultDataDir() string {
usr, _ := user.Current()
if runtime.GOOS == "darwin" {
- return path.Join(usr.HomeDir, "Library", "Ethereum")
+ return filepath.Join(usr.HomeDir, "Library", "Ethereum")
} else if runtime.GOOS == "windows" {
- return path.Join(usr.HomeDir, "AppData", "Roaming", "Ethereum")
+ return filepath.Join(usr.HomeDir, "AppData", "Roaming", "Ethereum")
} else {
- return path.Join(usr.HomeDir, ".ethereum")
+ return filepath.Join(usr.HomeDir, ".ethereum")
}
}