diff --git a/repolist.go b/repolist.go index 09dd8fb..9029c3e 100644 --- a/repolist.go +++ b/repolist.go @@ -3,7 +3,9 @@ package main import ( "io/ioutil" + "os" "os/user" + "path/filepath" "strings" "go.wit.com/gui" @@ -40,7 +42,9 @@ func splitLine(line string) (string, string, string, string) { } func myrepolist() []string { - content, _ := ioutil.ReadFile("/home/jcarr/.config/myrepolist") + homeDir, _ := os.UserHomeDir() + cfgfile := filepath.Join(homeDir, ".config/myrepolist") + content, _ := ioutil.ReadFile(cfgfile) out := string(content) out = strings.TrimSpace(out) lines := strings.Split(out, "\n") @@ -166,6 +170,8 @@ func repolistWindow() { reposgrid.NewLabel("Show()") + usr, _ := user.Current() + repos := myrepolist() for _, line := range repos { log.Verbose("repo =", line) @@ -176,19 +182,19 @@ func repolistWindow() { if dbranch == "" { dbranch = "devel" } - usr, _ := user.Current() if ubranch == "" { ubranch = usr.Username } addRepo(reposgrid, path, mbranch, dbranch, ubranch) } + // TODO: figure out why this borks everything /* for i, path := range repostatus.ListGitDirectories() { // log.Info("addRepo()", i, path) tmp := strings.TrimPrefix(path, me.goSrcPwd.String()) log.Info("addRepo()", i, tmp) - addRepo(reposgrid, tmp, "master", "master", "master") + addRepo(reposgrid, tmp, "guimaster", "guidevel", usr.Username) } */