Skip to content

Commit

Permalink
Merge pull request #178 from cryptix/noCgo
Browse files Browse the repository at this point in the history
rewrote HOME dir lookup (no cgo)
  • Loading branch information
jbenet committed Oct 15, 2014
2 parents fc6b0d4 + 960996d commit 2ed154b
Show file tree
Hide file tree
Showing 7 changed files with 201 additions and 14 deletions.
4 changes: 4 additions & 0 deletions Godeps/Godeps.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ NOTES:
all dependencies.
* Package managers often contain out-of-date `golang` packages.
Compilation from source is recommended.
* go-ipfs depends on cgo. In case you've disabled cgo, you'll need to
compile with `CGO_ENABLED=1`
* If you are interested in development, please install the development
dependencies as well.
* **WARNING: older versions of OSX FUSE (for Mac OS X) can cause kernel panics when mounting!**
Expand Down
14 changes: 2 additions & 12 deletions util/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@ import (
"errors"
"io"
"math/rand"
"os/user"
"path/filepath"
"strings"
"time"

ds "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/datastore.go"
"github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/mitchellh/go-homedir"
)

func init() {
Expand All @@ -34,16 +33,7 @@ var ErrNotFound = ds.ErrNotFound

// TildeExpansion expands a filename, which may begin with a tilde.
func TildeExpansion(filename string) (string, error) {
if strings.HasPrefix(filename, "~/") {
usr, err := user.Current()
if err != nil {
return "", err
}

dir := usr.HomeDir + "/"
filename = strings.Replace(filename, "~/", dir, 1)
}
return filename, nil
return homedir.Expand(filename)
}

// ExpandPathnames takes a set of paths and turns them into absolute paths
Expand Down

0 comments on commit 2ed154b

Please sign in to comment.