aboutsummaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorJeffrey Wilcke <jeffrey@ethereum.org>2015-05-12 23:23:46 +0800
committerJeffrey Wilcke <jeffrey@ethereum.org>2015-05-12 23:23:46 +0800
commit58d6ec689ff44232cd5d6a7cbbaad2d7a2cb44bd (patch)
treea5bfb1a0ade11c7f68d0322b9773e8c46571c455 /common
parentf87094b660c95b547486e7439620e68f3d59c45f (diff)
parent899df30c24c85ca0b2dadd4cbb251a4ec5ca1a75 (diff)
downloaddexon-58d6ec689ff44232cd5d6a7cbbaad2d7a2cb44bd.tar
dexon-58d6ec689ff44232cd5d6a7cbbaad2d7a2cb44bd.tar.gz
dexon-58d6ec689ff44232cd5d6a7cbbaad2d7a2cb44bd.tar.bz2
dexon-58d6ec689ff44232cd5d6a7cbbaad2d7a2cb44bd.tar.lz
dexon-58d6ec689ff44232cd5d6a7cbbaad2d7a2cb44bd.tar.xz
dexon-58d6ec689ff44232cd5d6a7cbbaad2d7a2cb44bd.tar.zst
dexon-58d6ec689ff44232cd5d6a7cbbaad2d7a2cb44bd.zip
Merge pull request #933 from bas-vk/issue928
replaced path with platform aware filepath module
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")
}
}