aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-07-02 02:08:18 +0800
committerobscuren <geffobscura@gmail.com>2014-07-02 02:08:18 +0800
commit3889785017a1381d215cb1dc47fd5fb5b38add79 (patch)
treebf3975b1947201dc601a289c60fdd0848b093913
parent7a9ff4f8d45e741625bc32fde59b3dfe90851492 (diff)
downloadgo-tangerine-3889785017a1381d215cb1dc47fd5fb5b38add79.tar
go-tangerine-3889785017a1381d215cb1dc47fd5fb5b38add79.tar.gz
go-tangerine-3889785017a1381d215cb1dc47fd5fb5b38add79.tar.bz2
go-tangerine-3889785017a1381d215cb1dc47fd5fb5b38add79.tar.lz
go-tangerine-3889785017a1381d215cb1dc47fd5fb5b38add79.tar.xz
go-tangerine-3889785017a1381d215cb1dc47fd5fb5b38add79.tar.zst
go-tangerine-3889785017a1381d215cb1dc47fd5fb5b38add79.zip
Added Path utility
-rw-r--r--ethutil/path.go20
1 files changed, 20 insertions, 0 deletions
diff --git a/ethutil/path.go b/ethutil/path.go
new file mode 100644
index 000000000..97f58ab7e
--- /dev/null
+++ b/ethutil/path.go
@@ -0,0 +1,20 @@
+package ethutil
+
+import (
+ "os/user"
+ "strings"
+)
+
+func ExpandHomePath(p string) (path string) {
+ path = p
+
+ // Check in case of paths like "/something/~/something/"
+ if path[:2] == "~/" {
+ usr, _ := user.Current()
+ dir := usr.HomeDir
+
+ path = strings.Replace(p, "~", dir, 1)
+ }
+
+ return
+}