diff options
author | Bas van Kervel <basvankervel@ziggo.nl> | 2015-05-12 20:24:11 +0800 |
---|---|---|
committer | Bas van Kervel <basvankervel@ziggo.nl> | 2015-05-12 20:24:11 +0800 |
commit | b79dd188d916da7adbf448dc27b0c59a04e0938d (patch) | |
tree | 7980ae848a916171fbc65fb958eebdf0c98406dc /cmd | |
parent | d82caa5ce38705d2dcdc2ba15c93df9325504e34 (diff) | |
download | dexon-b79dd188d916da7adbf448dc27b0c59a04e0938d.tar dexon-b79dd188d916da7adbf448dc27b0c59a04e0938d.tar.gz dexon-b79dd188d916da7adbf448dc27b0c59a04e0938d.tar.bz2 dexon-b79dd188d916da7adbf448dc27b0c59a04e0938d.tar.lz dexon-b79dd188d916da7adbf448dc27b0c59a04e0938d.tar.xz dexon-b79dd188d916da7adbf448dc27b0c59a04e0938d.tar.zst dexon-b79dd188d916da7adbf448dc27b0c59a04e0938d.zip |
replaced several path.* with filepath.* which is platform independent
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/geth/js.go | 5 | ||||
-rw-r--r-- | cmd/geth/js_test.go | 5 | ||||
-rw-r--r-- | cmd/geth/main.go | 5 | ||||
-rw-r--r-- | cmd/mist/gui.go | 7 | ||||
-rw-r--r-- | cmd/mist/html_container.go | 3 | ||||
-rw-r--r-- | cmd/mist/ui_lib.go | 7 | ||||
-rw-r--r-- | cmd/utils/flags.go | 13 |
7 files changed, 23 insertions, 22 deletions
diff --git a/cmd/geth/js.go b/cmd/geth/js.go index 9b0ab0a1b..d7c76d85c 100644 --- a/cmd/geth/js.go +++ b/cmd/geth/js.go @@ -22,9 +22,10 @@ import ( "fmt" "math/big" "os" - "path" "strings" + "path/filepath" + "github.com/ethereum/go-ethereum/cmd/utils" "github.com/ethereum/go-ethereum/common/docserver" "github.com/ethereum/go-ethereum/common/natspec" @@ -209,7 +210,7 @@ func (self *jsre) interactive() { } func (self *jsre) withHistory(op func(*os.File)) { - hist, err := os.OpenFile(path.Join(self.ethereum.DataDir, "history"), os.O_RDWR|os.O_CREATE, os.ModePerm) + hist, err := os.OpenFile(filepath.Join(self.ethereum.DataDir, "history"), os.O_RDWR|os.O_CREATE, os.ModePerm) if err != nil { fmt.Printf("unable to open history file: %v\n", err) return diff --git a/cmd/geth/js_test.go b/cmd/geth/js_test.go index 52a1ad03c..3f69876f4 100644 --- a/cmd/geth/js_test.go +++ b/cmd/geth/js_test.go @@ -4,7 +4,6 @@ import ( "fmt" "io/ioutil" "os" - "path" "path/filepath" "regexp" "runtime" @@ -96,7 +95,7 @@ func testJEthRE(t *testing.T) (string, *testjethre, *eth.Ethereum) { t.Fatal(err) } - assetPath := path.Join(os.Getenv("GOPATH"), "src", "github.com", "ethereum", "go-ethereum", "cmd", "mist", "assets", "ext") + assetPath := filepath.Join(os.Getenv("GOPATH"), "src", "github.com", "ethereum", "go-ethereum", "cmd", "mist", "assets", "ext") ds, err := docserver.New("/") if err != nil { t.Errorf("Error creating DocServer: %v", err) @@ -361,7 +360,7 @@ func checkEvalJSON(t *testing.T, re *testjethre, expr, want string) error { } if err != nil { _, file, line, _ := runtime.Caller(1) - file = path.Base(file) + file = filepath.Base(file) fmt.Printf("\t%s:%d: %v\n", file, line, err) t.Fail() } diff --git a/cmd/geth/main.go b/cmd/geth/main.go index 5da59ff3b..5fe83a2a0 100644 --- a/cmd/geth/main.go +++ b/cmd/geth/main.go @@ -26,7 +26,6 @@ import ( "io" "io/ioutil" "os" - "path" "path/filepath" "runtime" "strconv" @@ -565,7 +564,7 @@ func upgradeDb(ctx *cli.Context) { } filename := fmt.Sprintf("blockchain_%d_%s.chain", bcVersion, time.Now().Format("2006-01-02_15:04:05")) - exportFile := path.Join(ctx.GlobalString(utils.DataDirFlag.Name), filename) + exportFile := filepath.Join(ctx.GlobalString(utils.DataDirFlag.Name), filename) err = utils.ExportChain(ethereum.ChainManager(), exportFile) if err != nil { @@ -576,7 +575,7 @@ func upgradeDb(ctx *cli.Context) { ethereum.StateDb().Close() ethereum.ExtraDb().Close() - os.RemoveAll(path.Join(ctx.GlobalString(utils.DataDirFlag.Name), "blockchain")) + os.RemoveAll(filepath.Join(ctx.GlobalString(utils.DataDirFlag.Name), "blockchain")) ethereum, err = eth.New(cfg) if err != nil { diff --git a/cmd/mist/gui.go b/cmd/mist/gui.go index 66614478c..36eb488ce 100644 --- a/cmd/mist/gui.go +++ b/cmd/mist/gui.go @@ -27,11 +27,12 @@ import ( "fmt" "io/ioutil" "math/big" - "path" "runtime" "sort" "time" + "path/filepath" + "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core" "github.com/ethereum/go-ethereum/core/types" @@ -79,7 +80,7 @@ type Gui struct { // Create GUI, but doesn't start it func NewWindow(ethereum *eth.Ethereum) *Gui { - db, err := ethdb.NewLDBDatabase(path.Join(ethereum.DataDir, "tx_database")) + db, err := ethdb.NewLDBDatabase(filepath.Join(ethereum.DataDir, "tx_database")) if err != nil { panic(err) } @@ -92,7 +93,7 @@ func NewWindow(ethereum *eth.Ethereum) *Gui { plugins: make(map[string]plugin), serviceEvents: make(chan ServEv, 1), } - data, _ := ioutil.ReadFile(path.Join(ethereum.DataDir, "plugins.json")) + data, _ := ioutil.ReadFile(filepath.Join(ethereum.DataDir, "plugins.json")) json.Unmarshal(data, &gui.plugins) return gui diff --git a/cmd/mist/html_container.go b/cmd/mist/html_container.go index 7c948885a..c9b1f1cd6 100644 --- a/cmd/mist/html_container.go +++ b/cmd/mist/html_container.go @@ -26,7 +26,6 @@ import ( "io/ioutil" "net/url" "os" - "path" "path/filepath" "github.com/ethereum/go-ethereum/common" @@ -80,7 +79,7 @@ func (app *HtmlApplication) RootFolder() string { if err != nil { return "" } - return path.Dir(common.WindonizePath(folder.RequestURI())) + return filepath.Dir(common.WindonizePath(folder.RequestURI())) } func (app *HtmlApplication) RecursiveFolders() []os.FileInfo { files, _ := ioutil.ReadDir(app.RootFolder()) diff --git a/cmd/mist/ui_lib.go b/cmd/mist/ui_lib.go index 4653e0980..eaf42db28 100644 --- a/cmd/mist/ui_lib.go +++ b/cmd/mist/ui_lib.go @@ -22,7 +22,8 @@ package main import ( "io/ioutil" - "path" + + "path/filepath" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" @@ -110,7 +111,7 @@ func (ui *UiLib) ConnectToPeer(nodeURL string) { } func (ui *UiLib) AssetPath(p string) string { - return path.Join(ui.assetPath, p) + return filepath.Join(ui.assetPath, p) } func (self *UiLib) Transact(params map[string]interface{}) (string, error) { @@ -218,7 +219,7 @@ func (self *UiLib) Messages(id int) *common.List { } func (self *UiLib) ReadFile(p string) string { - content, err := ioutil.ReadFile(self.AssetPath(path.Join("ext", p))) + content, err := ioutil.ReadFile(self.AssetPath(filepath.Join("ext", p))) if err != nil { guilogger.Infoln("error reading file", p, ":", err) } diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index dd3b6c8a2..8c76a6edb 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -7,9 +7,10 @@ import ( "math/big" "net/http" "os" - "path" "runtime" + "path/filepath" + "github.com/codegangsta/cli" "github.com/ethereum/ethash" "github.com/ethereum/go-ethereum/accounts" @@ -55,7 +56,7 @@ OPTIONS: // NewApp creates an app with sane defaults. func NewApp(version, usage string) *cli.App { app := cli.NewApp() - app.Name = path.Base(os.Args[0]) + app.Name = filepath.Base(os.Args[0]) app.Author = "" //app.Authors = nil app.Email = "" @@ -319,17 +320,17 @@ func MakeEthConfig(clientID, version string, ctx *cli.Context) *eth.Config { func GetChain(ctx *cli.Context) (*core.ChainManager, common.Database, common.Database) { dataDir := ctx.GlobalString(DataDirFlag.Name) - blockDb, err := ethdb.NewLDBDatabase(path.Join(dataDir, "blockchain")) + blockDb, err := ethdb.NewLDBDatabase(filepath.Join(dataDir, "blockchain")) if err != nil { Fatalf("Could not open database: %v", err) } - stateDb, err := ethdb.NewLDBDatabase(path.Join(dataDir, "state")) + stateDb, err := ethdb.NewLDBDatabase(filepath.Join(dataDir, "state")) if err != nil { Fatalf("Could not open database: %v", err) } - extraDb, err := ethdb.NewLDBDatabase(path.Join(dataDir, "extra")) + extraDb, err := ethdb.NewLDBDatabase(filepath.Join(dataDir, "extra")) if err != nil { Fatalf("Could not open database: %v", err) } @@ -346,7 +347,7 @@ func GetChain(ctx *cli.Context) (*core.ChainManager, common.Database, common.Dat func GetAccountManager(ctx *cli.Context) *accounts.Manager { dataDir := ctx.GlobalString(DataDirFlag.Name) - ks := crypto.NewKeyStorePassphrase(path.Join(dataDir, "keys")) + ks := crypto.NewKeyStorePassphrase(filepath.Join(dataDir, "keys")) return accounts.NewManager(ks) } |