diff options
author | Maran <maran.hidskes@gmail.com> | 2015-02-23 18:28:20 +0800 |
---|---|---|
committer | Maran <maran.hidskes@gmail.com> | 2015-02-23 18:28:20 +0800 |
commit | 40adb7feb657cd1cb2e4c7a02c8a9db95b18e67c (patch) | |
tree | 98c3bae13e0483cfd6a8919b9b5a848f72d79071 /ethutil | |
parent | dd086791acf477da7641c168f82de70ed0b2dca6 (diff) | |
download | dexon-40adb7feb657cd1cb2e4c7a02c8a9db95b18e67c.tar.gz dexon-40adb7feb657cd1cb2e4c7a02c8a9db95b18e67c.tar.zst dexon-40adb7feb657cd1cb2e4c7a02c8a9db95b18e67c.zip |
Implement OS sensitive dataDirs
Diffstat (limited to 'ethutil')
-rw-r--r-- | ethutil/common.go | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/ethutil/common.go b/ethutil/common.go index 2ef2440c7..efc519732 100644 --- a/ethutil/common.go +++ b/ethutil/common.go @@ -3,10 +3,22 @@ package ethutil import ( "fmt" "math/big" + "os/user" + "path" "runtime" "time" ) +func DefaultDataDir() string { + usr, _ := user.Current() + if runtime.GOOS == "darwin" { + return path.Join(usr.HomeDir, "Library/Ethereum") + } else if runtime.GOOS == "windows" { + return path.Join(usr.HomeDir, "AppData/Roaming/Ethereum") + } else { + return path.Join(usr.HomeDir, ".ethereum") + } +} func IsWindows() bool { return runtime.GOOS == "windows" } |