aboutsummaryrefslogtreecommitdiffstats
path: root/ethutil
diff options
context:
space:
mode:
authorMaran <maran.hidskes@gmail.com>2015-02-23 18:28:20 +0800
committerMaran <maran.hidskes@gmail.com>2015-02-23 18:28:20 +0800
commit40adb7feb657cd1cb2e4c7a02c8a9db95b18e67c (patch)
tree98c3bae13e0483cfd6a8919b9b5a848f72d79071 /ethutil
parentdd086791acf477da7641c168f82de70ed0b2dca6 (diff)
downloadgo-tangerine-40adb7feb657cd1cb2e4c7a02c8a9db95b18e67c.tar.gz
go-tangerine-40adb7feb657cd1cb2e4c7a02c8a9db95b18e67c.tar.zst
go-tangerine-40adb7feb657cd1cb2e4c7a02c8a9db95b18e67c.zip
Implement OS sensitive dataDirs
Diffstat (limited to 'ethutil')
-rw-r--r--ethutil/common.go12
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"
}