|
|
|
@ -7,7 +7,6 @@ import (
|
|
|
|
|
"io/ioutil"
|
|
|
|
|
"log"
|
|
|
|
|
"os"
|
|
|
|
|
"os/user"
|
|
|
|
|
"strings"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
@ -50,12 +49,9 @@ func LoadConfig(filename string) (Config, error) {
|
|
|
|
|
MaxPoints: MAX_POINTS,
|
|
|
|
|
Mode: DEFAULT_MODE,
|
|
|
|
|
}
|
|
|
|
|
u, err := user.Current()
|
|
|
|
|
if err != nil {
|
|
|
|
|
return c, err
|
|
|
|
|
}
|
|
|
|
|
home := os.Getenv("HOME")
|
|
|
|
|
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) {
|
|
|
|
|
log.Printf("%+v not found, using defaults", filename)
|
|
|
|
|