diff options
author | zelig <viktor.tron@gmail.com> | 2015-03-16 23:46:29 +0800 |
---|---|---|
committer | zelig <viktor.tron@gmail.com> | 2015-03-16 23:46:29 +0800 |
commit | 5e7702fd050ed5520a03cc2cfc8b1f45a70f35fb (patch) | |
tree | d5ba6197a8c0c8e36bb92ee9fc8aad717cb2d178 /ethutil/path.go | |
parent | 8393dab470c40678caf36ada82e312d29c4cf5c4 (diff) | |
parent | 22893b7ac925c49168c119f293ea8befc3aff5cc (diff) | |
download | dexon-5e7702fd050ed5520a03cc2cfc8b1f45a70f35fb.tar dexon-5e7702fd050ed5520a03cc2cfc8b1f45a70f35fb.tar.gz dexon-5e7702fd050ed5520a03cc2cfc8b1f45a70f35fb.tar.bz2 dexon-5e7702fd050ed5520a03cc2cfc8b1f45a70f35fb.tar.lz dexon-5e7702fd050ed5520a03cc2cfc8b1f45a70f35fb.tar.xz dexon-5e7702fd050ed5520a03cc2cfc8b1f45a70f35fb.tar.zst dexon-5e7702fd050ed5520a03cc2cfc8b1f45a70f35fb.zip |
Merge remote-tracking branch 'upstream/develop' into frontier/js
Conflicts:
cmd/ethereum/js.go
javascript/types.go
Diffstat (limited to 'ethutil/path.go')
-rw-r--r-- | ethutil/path.go | 68 |
1 files changed, 0 insertions, 68 deletions
diff --git a/ethutil/path.go b/ethutil/path.go deleted file mode 100644 index e545c8731..000000000 --- a/ethutil/path.go +++ /dev/null @@ -1,68 +0,0 @@ -package ethutil - -import ( - "io/ioutil" - "os" - "os/user" - "path" - "strings" -) - -func ExpandHomePath(p string) (path string) { - path = p - - // Check in case of paths like "/something/~/something/" - if len(path) > 1 && path[:2] == "~/" { - usr, _ := user.Current() - dir := usr.HomeDir - - path = strings.Replace(p, "~", dir, 1) - } - - return -} - -func FileExist(filePath string) bool { - _, err := os.Stat(filePath) - if err != nil && os.IsNotExist(err) { - return false - } - - return true -} - -func ReadAllFile(filePath string) (string, error) { - file, err := os.Open(filePath) - if err != nil { - return "", err - } - - data, err := ioutil.ReadAll(file) - if err != nil { - return "", err - } - - return string(data), nil -} - -func WriteFile(filePath string, content []byte) error { - fh, err := os.OpenFile(filePath, os.O_TRUNC|os.O_RDWR|os.O_CREATE, os.ModePerm) - if err != nil { - return err - } - defer fh.Close() - - _, err = fh.Write(content) - if err != nil { - return err - } - - return nil -} - -func AbsolutePath(Datadir string, filename string) string { - if path.IsAbs(filename) { - return filename - } - return path.Join(Datadir, filename) -} |