diff options
author | Jeffrey Wilcke <jeffrey@ethereum.org> | 2015-05-12 23:23:46 +0800 |
---|---|---|
committer | Jeffrey Wilcke <jeffrey@ethereum.org> | 2015-05-12 23:23:46 +0800 |
commit | 58d6ec689ff44232cd5d6a7cbbaad2d7a2cb44bd (patch) | |
tree | a5bfb1a0ade11c7f68d0322b9773e8c46571c455 /cmd | |
parent | f87094b660c95b547486e7439620e68f3d59c45f (diff) | |
parent | 899df30c24c85ca0b2dadd4cbb251a4ec5ca1a75 (diff) | |
download | dexon-58d6ec689ff44232cd5d6a7cbbaad2d7a2cb44bd.tar.gz 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 'cmd')
-rw-r--r-- | cmd/geth/js.go | 4 | ||||
-rw-r--r-- | cmd/geth/js_test.go | 5 | ||||
-rw-r--r-- | cmd/geth/main.go | 5 | ||||
-rw-r--r-- | cmd/mist/gui.go | 6 | ||||
-rw-r--r-- | cmd/mist/html_container.go | 3 | ||||
-rw-r--r-- | cmd/mist/ui_lib.go | 6 | ||||
-rw-r--r-- | cmd/utils/flags.go | 12 |
7 files changed, 19 insertions, 22 deletions
diff --git a/cmd/geth/js.go b/cmd/geth/js.go index 9b0ab0a1b..61e97433a 100644 --- a/cmd/geth/js.go +++ b/cmd/geth/js.go @@ -22,7 +22,7 @@ import ( "fmt" "math/big" "os" - "path" + "path/filepath" "strings" "github.com/ethereum/go-ethereum/cmd/utils" @@ -209,7 +209,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 d4bf81d54..9b6d503ab 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) @@ -362,7 +361,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..53194ae50 100644 --- a/cmd/mist/gui.go +++ b/cmd/mist/gui.go @@ -27,7 +27,7 @@ import ( "fmt" "io/ioutil" "math/big" - "path" + "path/filepath" "runtime" "sort" "time" @@ -79,7 +79,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 +92,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 0958294c3..0618c5e92 100644 --- a/cmd/mist/ui_lib.go +++ b/cmd/mist/ui_lib.go @@ -22,7 +22,7 @@ package main import ( "io/ioutil" - "path" + "path/filepath" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" @@ -110,7 +110,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 +218,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..339dd3f47 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -7,7 +7,7 @@ import ( "math/big" "net/http" "os" - "path" + "path/filepath" "runtime" "github.com/codegangsta/cli" @@ -55,7 +55,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 +319,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 +346,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) } |