Browse Source

Removed dependance on os/user

This was done to make cross-compiling work again
Stephen McQuay 5 years ago
parent
commit
06ce7eefc8
1 changed files with 2 additions and 6 deletions
  1. 2
    6
      config.go

+ 2
- 6
config.go View File

@@ -7,7 +7,6 @@ import (
7 7
 	"io/ioutil"
8 8
 	"log"
9 9
 	"os"
10
-	"os/user"
11 10
 	"strings"
12 11
 )
13 12
 
@@ -50,12 +49,9 @@ func LoadConfig(filename string) (Config, error) {
50 49
 		MaxPoints:     MAX_POINTS,
51 50
 		Mode:          DEFAULT_MODE,
52 51
 	}
53
-	u, err := user.Current()
54
-	if err != nil {
55
-		return c, err
56
-	}
52
+	home := os.Getenv("HOME")
57 53
 	if len(filename) > 1 && filename[:2] == "~/" {
58
-		filename = strings.Replace(filename, "~", u.HomeDir, 1)
54
+		filename = strings.Replace(filename, "~", home, 1)
59 55
 	}
60 56
 	if _, err := os.Stat(filename); os.IsNotExist(err) {
61 57
 		log.Printf("%+v not found, using defaults", filename)

Loading…
Cancel
Save