rewrote HOME dir lookup (no cgo)
Henry committed
Oct 15, 2014 at 11:58 UTC
0dd3316c16a1e4f07c74ea92e15b51bfe6d086b6
2 files changed
+2
-10
README.md
-2
@@ -22,8 +22,6 @@ NOTES:
22
all dependencies.
23
* Package managers often contain out-of-date `golang` packages.
24
Compilation from source is recommended.
25
-* go-ipfs depends on cgo. In case you've disabled cgo, you'll need to
26
- compile with `CGO_ENABLED=1`
25
* If you are interested in development, please install the development
26
dependencies as well.
27
* **WARNING: older versions of OSX FUSE (for Mac OS X) can cause kernel panics when mounting!**
util/util.go
+2
-8
@@ -4,7 +4,7 @@ import (
4
"errors"
5
"io"
6
"math/rand"
7
- "os/user"
7
+ "os"
8
"path/filepath"
9
"strings"
10
"time"
@@ -35,13 +35,7 @@ var ErrNotFound = ds.ErrNotFound
35
// TildeExpansion expands a filename, which may begin with a tilde.
36
func TildeExpansion(filename string) (string, error) {
37
if strings.HasPrefix(filename, "~/") {
38
- usr, err := user.Current()
39
- if err != nil {
40
- return "", err
41
- }
42
-
43
- dir := usr.HomeDir + "/"
44
- filename = strings.Replace(filename, "~/", dir, 1)
38
+ filename = strings.Replace(filename, "~", os.Getenv("HOME"), 1)
39
}
40
return filename, nil
41
}