Replace user.Home() with os.HomeDir() to remove CGo dependency (hopefully)
This commit is contained in:
parent
65b77f33cc
commit
d2d9418b8b
|
@ -8,7 +8,6 @@ import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"math/big"
|
"math/big"
|
||||||
"os/user"
|
|
||||||
"regexp"
|
"regexp"
|
||||||
|
|
||||||
"crypto/rand"
|
"crypto/rand"
|
||||||
|
@ -604,15 +603,15 @@ func pickFile(args []string, filters *filters, sort string, cache *fileCache, fo
|
||||||
}
|
}
|
||||||
|
|
||||||
func normalizePath(path string) (string, error) {
|
func normalizePath(path string) (string, error) {
|
||||||
usr, err := user.Current()
|
homeDir, err := os.UserHomeDir()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
|
||||||
if path == "~" {
|
if path == "~" {
|
||||||
path = usr.HomeDir
|
path = homeDir
|
||||||
} else if strings.HasPrefix(path, "~/") {
|
} else if strings.HasPrefix(path, "~/") {
|
||||||
path = filepath.Join(usr.HomeDir, path[2:])
|
path = filepath.Join(homeDir, path[2:])
|
||||||
}
|
}
|
||||||
|
|
||||||
path, err = filepath.EvalSymlinks(path)
|
path, err = filepath.EvalSymlinks(path)
|
||||||
|
|
|
@ -12,7 +12,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
ReleaseVersion string = "0.78.1"
|
ReleaseVersion string = "0.78.2"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
Loading…
Reference in New Issue