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 /crypto | |
parent | f87094b660c95b547486e7439620e68f3d59c45f (diff) | |
parent | 899df30c24c85ca0b2dadd4cbb251a4ec5ca1a75 (diff) | |
download | dexon-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 'crypto')
-rw-r--r-- | crypto/key_store_passphrase.go | 4 | ||||
-rw-r--r-- | crypto/key_store_plain.go | 10 |
2 files changed, 7 insertions, 7 deletions
diff --git a/crypto/key_store_passphrase.go b/crypto/key_store_passphrase.go index 7d21b6604..9d36d7b03 100644 --- a/crypto/key_store_passphrase.go +++ b/crypto/key_store_passphrase.go @@ -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 := filepath.Join(ks.keysDirPath, hex.EncodeToString(keyAddr)) return os.RemoveAll(keyDirPath) } diff --git a/crypto/key_store_plain.go b/crypto/key_store_plain.go index 9bbaf1c15..581968d7c 100644 --- a/crypto/key_store_plain.go +++ b/crypto/key_store_plain.go @@ -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 := filepath.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(filepath.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 := filepath.Join(keysDirPath, addrHex) + keyFilePath := filepath.Join(keyDirPath, addrHex) err = os.MkdirAll(keyDirPath, 0700) // read, write and dir search for user if err != nil { return err |