ipld-eth-server/vendor/github.com/ipfs/go-ipfs/repo/fsrepo/misc.go
2019-12-02 13:24:46 -06:00

24 lines
619 B
Go

package fsrepo
import (
"os"
config "gx/ipfs/QmUAuYuiafnJRZxDDX7MuruMNsicYNuyub5vUeAcupUBNs/go-ipfs-config"
homedir "gx/ipfs/QmdcULN1WCzgoQmcCaUAmEhwcxHYsDrbZ2LvRJKCL8dMrK/go-homedir"
)
// BestKnownPath returns the best known fsrepo path. If the ENV override is
// present, this function returns that value. Otherwise, it returns the default
// repo path.
func BestKnownPath() (string, error) {
ipfsPath := config.DefaultPathRoot
if os.Getenv(config.EnvDir) != "" {
ipfsPath = os.Getenv(config.EnvDir)
}
ipfsPath, err := homedir.Expand(ipfsPath)
if err != nil {
return "", err
}
return ipfsPath, nil
}