mirror of
https://github.com/sorenisanerd/gotty.git
synced 2024-11-25 05:04:25 +00:00
Replace user.Current()
with os.Getenv("HOME")
`os/user.Current()` is not available on Darwin when a binary is cross compiled from another platform. See also: https://github.com/golang/go/issues/6376
This commit is contained in:
parent
56ae9ab9fc
commit
ee45d8e145
@ -12,7 +12,6 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"os/user"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"text/template"
|
"text/template"
|
||||||
@ -53,11 +52,7 @@ func New(options Options) (*App, error) {
|
|||||||
prefString := []byte{}
|
prefString := []byte{}
|
||||||
prefPath := options.ProfileFile
|
prefPath := options.ProfileFile
|
||||||
if options.ProfileFile == DefaultProfileFilePath {
|
if options.ProfileFile == DefaultProfileFilePath {
|
||||||
usr, err := user.Current()
|
prefPath = os.Getenv("HOME") + "/.gotty"
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
prefPath = usr.HomeDir + "/.gotty"
|
|
||||||
}
|
}
|
||||||
if _, err = os.Stat(prefPath); os.IsNotExist(err) {
|
if _, err = os.Stat(prefPath); os.IsNotExist(err) {
|
||||||
if options.ProfileFile != DefaultProfileFilePath {
|
if options.ProfileFile != DefaultProfileFilePath {
|
||||||
|
Loading…
Reference in New Issue
Block a user