Removed dependance on os/user
This was done to make cross-compiling work again
This commit is contained in:
parent
c9dfa27320
commit
06ce7eefc8
@ -7,7 +7,6 @@ import (
|
|||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"os/user"
|
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -50,12 +49,9 @@ func LoadConfig(filename string) (Config, error) {
|
|||||||
MaxPoints: MAX_POINTS,
|
MaxPoints: MAX_POINTS,
|
||||||
Mode: DEFAULT_MODE,
|
Mode: DEFAULT_MODE,
|
||||||
}
|
}
|
||||||
u, err := user.Current()
|
home := os.Getenv("HOME")
|
||||||
if err != nil {
|
|
||||||
return c, err
|
|
||||||
}
|
|
||||||
if len(filename) > 1 && filename[:2] == "~/" {
|
if len(filename) > 1 && filename[:2] == "~/" {
|
||||||
filename = strings.Replace(filename, "~", u.HomeDir, 1)
|
filename = strings.Replace(filename, "~", home, 1)
|
||||||
}
|
}
|
||||||
if _, err := os.Stat(filename); os.IsNotExist(err) {
|
if _, err := os.Stat(filename); os.IsNotExist(err) {
|
||||||
log.Printf("%+v not found, using defaults", filename)
|
log.Printf("%+v not found, using defaults", filename)
|
||||||
|
Loading…
Reference in New Issue
Block a user