replaced several path.* with filepath.* which is platform independent
This commit is contained in:
@ -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
|
||||
|
@ -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()
|
||||
}
|
||||
|
@ -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 {
|
||||
|
@ -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
|
||||
|
@ -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())
|
||||
|
@ -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)
|
||||
}
|
||||
|
@ -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)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user