Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
58d6ec68
Commit
58d6ec68
authored
May 12, 2015
by
Jeffrey Wilcke
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #933 from bas-vk/issue928
replaced path with platform aware filepath module
parents
f87094b6
899df30c
Changes
18
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
58 additions
and
64 deletions
+58
-64
js.go
cmd/geth/js.go
+2
-2
js_test.go
cmd/geth/js_test.go
+2
-3
main.go
cmd/geth/main.go
+2
-3
gui.go
cmd/mist/gui.go
+3
-3
html_container.go
cmd/mist/html_container.go
+1
-2
ui_lib.go
cmd/mist/ui_lib.go
+3
-3
flags.go
cmd/utils/flags.go
+6
-6
solidity.go
common/compiler/solidity.go
+4
-5
path.go
common/path.go
+10
-11
chain_manager_test.go
core/chain_manager_test.go
+2
-2
key_store_passphrase.go
crypto/key_store_passphrase.go
+2
-2
key_store_plain.go
crypto/key_store_plain.go
+5
-5
backend.go
eth/backend.go
+6
-7
database_test.go
ethdb/database_test.go
+2
-2
defaults.go
generators/defaults.go
+2
-2
udp_test.go
p2p/discover/udp_test.go
+2
-2
block_test.go
tests/block_test.go
+2
-2
update-license.go
update-license.go
+2
-2
No files found.
cmd/geth/js.go
View file @
58d6ec68
...
...
@@ -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
(
file
path
.
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
...
...
cmd/geth/js_test.go
View file @
58d6ec68
...
...
@@ -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
:=
file
path
.
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
=
file
path
.
Base
(
file
)
fmt
.
Printf
(
"
\t
%s:%d: %v
\n
"
,
file
,
line
,
err
)
t
.
Fail
()
}
...
...
cmd/geth/main.go
View file @
58d6ec68
...
...
@@ -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
:=
file
path
.
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
(
file
path
.
Join
(
ctx
.
GlobalString
(
utils
.
DataDirFlag
.
Name
),
"blockchain"
))
ethereum
,
err
=
eth
.
New
(
cfg
)
if
err
!=
nil
{
...
...
cmd/mist/gui.go
View file @
58d6ec68
...
...
@@ -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
(
file
path
.
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
(
file
path
.
Join
(
ethereum
.
DataDir
,
"plugins.json"
))
json
.
Unmarshal
(
data
,
&
gui
.
plugins
)
return
gui
...
...
cmd/mist/html_container.go
View file @
58d6ec68
...
...
@@ -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
file
path
.
Dir
(
common
.
WindonizePath
(
folder
.
RequestURI
()))
}
func
(
app
*
HtmlApplication
)
RecursiveFolders
()
[]
os
.
FileInfo
{
files
,
_
:=
ioutil
.
ReadDir
(
app
.
RootFolder
())
...
...
cmd/mist/ui_lib.go
View file @
58d6ec68
...
...
@@ -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
file
path
.
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
(
file
path
.
Join
(
"ext"
,
p
)))
if
err
!=
nil
{
guilogger
.
Infoln
(
"error reading file"
,
p
,
":"
,
err
)
}
...
...
cmd/utils/flags.go
View file @
58d6ec68
...
...
@@ -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
=
file
path
.
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
(
file
path
.
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
(
file
path
.
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
(
file
path
.
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
(
file
path
.
Join
(
dataDir
,
"keys"
))
return
accounts
.
NewManager
(
ks
)
}
...
...
common/compiler/solidity.go
View file @
58d6ec68
...
...
@@ -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
:=
file
path
.
Join
(
wd
,
base
+
".binary"
)
abiDefinitionFile
:=
file
path
.
Join
(
wd
,
base
+
".abi"
)
userDocFile
:=
file
path
.
Join
(
wd
,
base
+
".docuser"
)
developerDocFile
:=
file
path
.
Join
(
wd
,
base
+
".docdev"
)
code
,
err
:=
ioutil
.
ReadFile
(
codeFile
)
if
err
!=
nil
{
...
...
common/path.go
View file @
58d6ec68
...
...
@@ -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
file
path
.
IsAbs
(
filename
)
{
return
filename
}
return
path
.
Join
(
Datadir
,
filename
)
return
file
path
.
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
:=
file
path
.
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
=
file
path
.
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
=
file
path
.
Join
(
"usr"
,
"share"
,
"mist"
)
case
"windows"
:
assetPath
=
path
.
Join
(
"."
,
"assets"
)
assetPath
=
file
path
.
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
=
file
path
.
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
file
path
.
Join
(
usr
.
HomeDir
,
"Library"
,
"Ethereum"
)
}
else
if
runtime
.
GOOS
==
"windows"
{
return
path
.
Join
(
usr
.
HomeDir
,
"AppData"
,
"Roaming"
,
"Ethereum"
)
return
file
path
.
Join
(
usr
.
HomeDir
,
"AppData"
,
"Roaming"
,
"Ethereum"
)
}
else
{
return
path
.
Join
(
usr
.
HomeDir
,
".ethereum"
)
return
file
path
.
Join
(
usr
.
HomeDir
,
".ethereum"
)
}
}
...
...
core/chain_manager_test.go
View file @
58d6ec68
...
...
@@ -4,7 +4,7 @@ import (
"fmt"
"math/big"
"os"
"path"
"path
/filepath
"
"runtime"
"strconv"
"testing"
...
...
@@ -94,7 +94,7 @@ func testChain(chainB types.Blocks, bman *BlockProcessor) (*big.Int, error) {
}
func
loadChain
(
fn
string
,
t
*
testing
.
T
)
(
types
.
Blocks
,
error
)
{
fh
,
err
:=
os
.
OpenFile
(
path
.
Join
(
os
.
Getenv
(
"GOPATH"
),
"src"
,
"github.com"
,
"ethereum"
,
"go-ethereum"
,
"_data"
,
fn
),
os
.
O_RDONLY
,
os
.
ModePerm
)
fh
,
err
:=
os
.
OpenFile
(
file
path
.
Join
(
os
.
Getenv
(
"GOPATH"
),
"src"
,
"github.com"
,
"ethereum"
,
"go-ethereum"
,
"_data"
,
fn
),
os
.
O_RDONLY
,
os
.
ModePerm
)
if
err
!=
nil
{
return
nil
,
err
}
...
...
crypto/key_store_passphrase.go
View file @
58d6ec68
...
...
@@ -72,7 +72,7 @@ import (
"errors"
"io"
"os"
"path"
"path
/filepath
"
"code.google.com/p/go-uuid/uuid"
"github.com/ethereum/go-ethereum/crypto/randentropy"
...
...
@@ -163,7 +163,7 @@ func (ks keyStorePassphrase) DeleteKey(keyAddr []byte, auth string) (err error)
return
err
}
keyDirPath
:=
path
.
Join
(
ks
.
keysDirPath
,
hex
.
EncodeToString
(
keyAddr
))
keyDirPath
:=
file
path
.
Join
(
ks
.
keysDirPath
,
hex
.
EncodeToString
(
keyAddr
))
return
os
.
RemoveAll
(
keyDirPath
)
}
...
...
crypto/key_store_plain.go
View file @
58d6ec68
...
...
@@ -30,7 +30,7 @@ import (
"io"
"io/ioutil"
"os"
"path"
"path
/filepath
"
)
// TODO: rename to KeyStore when replacing existing KeyStore
...
...
@@ -91,20 +91,20 @@ func (ks keyStorePlain) StoreKey(key *Key, auth string) (err error) {
}
func
(
ks
keyStorePlain
)
DeleteKey
(
keyAddr
[]
byte
,
auth
string
)
(
err
error
)
{
keyDirPath
:=
path
.
Join
(
ks
.
keysDirPath
,
hex
.
EncodeToString
(
keyAddr
))
keyDirPath
:=
file
path
.
Join
(
ks
.
keysDirPath
,
hex
.
EncodeToString
(
keyAddr
))
err
=
os
.
RemoveAll
(
keyDirPath
)
return
err
}
func
GetKeyFile
(
keysDirPath
string
,
keyAddr
[]
byte
)
(
fileContent
[]
byte
,
err
error
)
{
fileName
:=
hex
.
EncodeToString
(
keyAddr
)
return
ioutil
.
ReadFile
(
path
.
Join
(
keysDirPath
,
fileName
,
fileName
))
return
ioutil
.
ReadFile
(
file
path
.
Join
(
keysDirPath
,
fileName
,
fileName
))
}
func
WriteKeyFile
(
addr
[]
byte
,
keysDirPath
string
,
content
[]
byte
)
(
err
error
)
{
addrHex
:=
hex
.
EncodeToString
(
addr
)
keyDirPath
:=
path
.
Join
(
keysDirPath
,
addrHex
)
keyFilePath
:=
path
.
Join
(
keyDirPath
,
addrHex
)
keyDirPath
:=
file
path
.
Join
(
keysDirPath
,
addrHex
)
keyFilePath
:=
file
path
.
Join
(
keyDirPath
,
addrHex
)
err
=
os
.
MkdirAll
(
keyDirPath
,
0700
)
// read, write and dir search for user
if
err
!=
nil
{
return
err
...
...
eth/backend.go
View file @
58d6ec68
...
...
@@ -7,7 +7,6 @@ import (
"io/ioutil"
"math/big"
"os"
"path"
"path/filepath"
"strings"
"time"
...
...
@@ -145,7 +144,7 @@ func (cfg *Config) nodeKey() (*ecdsa.PrivateKey, error) {
return
cfg
.
NodeKey
,
nil
}
// use persistent key if present
keyfile
:=
path
.
Join
(
cfg
.
DataDir
,
"nodekey"
)
keyfile
:=
file
path
.
Join
(
cfg
.
DataDir
,
"nodekey"
)
key
,
err
:=
crypto
.
LoadECDSA
(
keyfile
)
if
err
==
nil
{
return
key
,
nil
...
...
@@ -215,25 +214,25 @@ func New(config *Config) (*Ethereum, error) {
if
newdb
==
nil
{
newdb
=
func
(
path
string
)
(
common
.
Database
,
error
)
{
return
ethdb
.
NewLDBDatabase
(
path
)
}
}
blockDb
,
err
:=
newdb
(
path
.
Join
(
config
.
DataDir
,
"blockchain"
))
blockDb
,
err
:=
newdb
(
file
path
.
Join
(
config
.
DataDir
,
"blockchain"
))
if
err
!=
nil
{
return
nil
,
fmt
.
Errorf
(
"blockchain db err: %v"
,
err
)
}
stateDb
,
err
:=
newdb
(
path
.
Join
(
config
.
DataDir
,
"state"
))
stateDb
,
err
:=
newdb
(
file
path
.
Join
(
config
.
DataDir
,
"state"
))
if
err
!=
nil
{
return
nil
,
fmt
.
Errorf
(
"state db err: %v"
,
err
)
}
extraDb
,
err
:=
newdb
(
path
.
Join
(
config
.
DataDir
,
"extra"
))
extraDb
,
err
:=
newdb
(
file
path
.
Join
(
config
.
DataDir
,
"extra"
))
if
err
!=
nil
{
return
nil
,
fmt
.
Errorf
(
"extra db err: %v"
,
err
)
}
nodeDb
:=
path
.
Join
(
config
.
DataDir
,
"nodes"
)
nodeDb
:=
file
path
.
Join
(
config
.
DataDir
,
"nodes"
)
// Perform database sanity checks
d
,
_
:=
blockDb
.
Get
([]
byte
(
"ProtocolVersion"
))
protov
:=
int
(
common
.
NewValue
(
d
)
.
Uint
())
if
protov
!=
config
.
ProtocolVersion
&&
protov
!=
0
{
path
:=
path
.
Join
(
config
.
DataDir
,
"blockchain"
)
path
:=
file
path
.
Join
(
config
.
DataDir
,
"blockchain"
)
return
nil
,
fmt
.
Errorf
(
"Database version mismatch. Protocol(%d / %d). `rm -rf %s`"
,
protov
,
config
.
ProtocolVersion
,
path
)
}
saveProtocolVersion
(
blockDb
,
config
.
ProtocolVersion
)
...
...
ethdb/database_test.go
View file @
58d6ec68
...
...
@@ -2,13 +2,13 @@ package ethdb
import
(
"os"
"path"
"path
/filepath
"
"github.com/ethereum/go-ethereum/common"
)
func
newDb
()
*
LDBDatabase
{
file
:=
path
.
Join
(
"/"
,
"tmp"
,
"ldbtesttmpfile"
)
file
:=
file
path
.
Join
(
"/"
,
"tmp"
,
"ldbtesttmpfile"
)
if
common
.
FileExist
(
file
)
{
os
.
RemoveAll
(
file
)
}
...
...
generators/defaults.go
View file @
58d6ec68
...
...
@@ -8,7 +8,7 @@ import (
"io/ioutil"
"os"
"os/exec"
"path"
"path
/filepath
"
"strings"
)
...
...
@@ -35,7 +35,7 @@ func main() {
m
:=
make
(
map
[
string
]
setting
)
json
.
Unmarshal
(
content
,
&
m
)
filepath
:=
path
.
Join
(
os
.
Getenv
(
"GOPATH"
),
"src"
,
"github.com"
,
"ethereum"
,
"go-ethereum"
,
"params"
,
os
.
Args
[
2
])
filepath
:=
file
path
.
Join
(
os
.
Getenv
(
"GOPATH"
),
"src"
,
"github.com"
,
"ethereum"
,
"go-ethereum"
,
"params"
,
os
.
Args
[
2
])
output
,
err
:=
os
.
OpenFile
(
filepath
,
os
.
O_RDWR
|
os
.
O_CREATE
,
os
.
ModePerm
/*0777*/
)
if
err
!=
nil
{
fatal
(
"error opening file for writing %v
\n
"
,
err
)
...
...
p2p/discover/udp_test.go
View file @
58d6ec68
...
...
@@ -9,7 +9,7 @@ import (
logpkg
"log"
"net"
"os"
"path"
"path
/filepath
"
"reflect"
"runtime"
"sync"
...
...
@@ -88,7 +88,7 @@ func (test *udpTest) waitPacketOut(validate interface{}) error {
func
(
test
*
udpTest
)
errorf
(
format
string
,
args
...
interface
{})
error
{
_
,
file
,
line
,
ok
:=
runtime
.
Caller
(
2
)
// errorf + waitPacketOut
if
ok
{
file
=
path
.
Base
(
file
)
file
=
file
path
.
Base
(
file
)
}
else
{
file
=
"???"
line
=
1
...
...
tests/block_test.go
View file @
58d6ec68
package
tests
import
(
"path"
"path
/filepath
"
"testing"
"github.com/ethereum/go-ethereum/accounts"
...
...
@@ -99,7 +99,7 @@ func runBlockTest(name string, test *BlockTest, t *testing.T) {
}
func
testEthConfig
()
*
eth
.
Config
{
ks
:=
crypto
.
NewKeyStorePassphrase
(
path
.
Join
(
common
.
DefaultDataDir
(),
"keys"
))
ks
:=
crypto
.
NewKeyStorePassphrase
(
file
path
.
Join
(
common
.
DefaultDataDir
(),
"keys"
))
return
&
eth
.
Config
{
DataDir
:
common
.
DefaultDataDir
(),
...
...
update-license.go
View file @
58d6ec68
...
...
@@ -26,7 +26,7 @@ import (
"io/ioutil"
"os"
"os/exec"
"path"
"path
/filepath
"
"regexp"
"runtime"
"sort"
...
...
@@ -144,7 +144,7 @@ func getFiles(out chan<- string) {
return
}
}
ext
:=
path
.
Ext
(
line
)
ext
:=
file
path
.
Ext
(
line
)
for
_
,
wantExt
:=
range
extensions
{
if
ext
==
wantExt
{
goto
send
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment