aboutsummaryrefslogtreecommitdiffstats
path: root/ethutil
diff options
context:
space:
mode:
authorJeffrey Wilcke <jeffrey@ethereum.org>2015-02-25 00:30:44 +0800
committerJeffrey Wilcke <jeffrey@ethereum.org>2015-02-25 00:30:44 +0800
commit91a8c08f037c1ec737d15ce00c6720015347e0d6 (patch)
tree172ed9fe314ecf7a873814e187353499d088952d /ethutil
parent0b757ad12f6e79f8d8d92e412425f46a66d408c1 (diff)
parent40adb7feb657cd1cb2e4c7a02c8a9db95b18e67c (diff)
downloadgo-tangerine-91a8c08f037c1ec737d15ce00c6720015347e0d6.tar.gz
go-tangerine-91a8c08f037c1ec737d15ce00c6720015347e0d6.tar.zst
go-tangerine-91a8c08f037c1ec737d15ce00c6720015347e0d6.zip
Merge pull request #368 from maran/feature/changeDataDir
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"
}