Replace user.Home() with os.HomeDir() to remove CGo dependency (hopefully)

This commit is contained in:
Seednode 2023-09-13 12:46:14 -05:00
parent 65b77f33cc
commit d2d9418b8b
2 changed files with 4 additions and 5 deletions

View File

@ -8,7 +8,6 @@ import (
"errors"
"fmt"
"math/big"
"os/user"
"regexp"
"crypto/rand"
@ -604,15 +603,15 @@ func pickFile(args []string, filters *filters, sort string, cache *fileCache, fo
}
func normalizePath(path string) (string, error) {
usr, err := user.Current()
homeDir, err := os.UserHomeDir()
if err != nil {
return "", err
}
if path == "~" {
path = usr.HomeDir
path = homeDir
} else if strings.HasPrefix(path, "~/") {
path = filepath.Join(usr.HomeDir, path[2:])
path = filepath.Join(homeDir, path[2:])
}
path, err = filepath.EvalSymlinks(path)

View File

@ -12,7 +12,7 @@ import (
)
const (
ReleaseVersion string = "0.78.1"
ReleaseVersion string = "0.78.2"
)
var (