aboutsummaryrefslogtreecommitdiffstats
path: root/common
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
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')
-rw-r--r--common/compiler/solidity.go9
-rw-r--r--common/path.go21
2 files changed, 14 insertions, 16 deletions
diff --git a/common/compiler/solidity.go b/common/compiler/solidity.go
index 3462436b7..6790f9a1d 100644
--- a/common/compiler/solidity.go
+++ b/common/compiler/solidity.go
@@ -7,7 +7,6 @@ import (
"io/ioutil"
"os"
"os/exec"
- "path"
"path/filepath"
"regexp"
"strings"
@@ -130,10 +129,10 @@ func (sol *Solidity) Compile(source string) (contract *Contract, err error) {
_, file := filepath.Split(matches[0])
base := strings.Split(file, ".")[0]
- codeFile := path.Join(wd, base+".binary")
- abiDefinitionFile := path.Join(wd, base+".abi")
- userDocFile := path.Join(wd, base+".docuser")
- developerDocFile := path.Join(wd, base+".docdev")
+ codeFile := filepath.Join(wd, base+".binary")
+ abiDefinitionFile := filepath.Join(wd, base+".abi")
+ userDocFile := filepath.Join(wd, base+".docuser")
+ developerDocFile := filepath.Join(wd, base+".docdev")
code, err := ioutil.ReadFile(codeFile)
if err != nil {
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")
}
}