summaryrefslogtreecommitdiff
path: root/src/rhlibrary/main.go
diff options
context:
space:
mode:
authorChristian Pointner <equinox@helsinki.at>2016-02-03 16:56:15 (GMT)
committerChristian Pointner <equinox@helsinki.at>2016-02-03 16:56:15 (GMT)
commit6e820d4dc8e5b814ddadfd9d295acac4cd2ca916 (patch)
tree2136e54c8fe16cb7d9ae9d33d3f98d61db2dacf8 /src/rhlibrary/main.go
parent784a184c3f292f9c84138dba180e4b30bca341a3 (diff)
fetch username from system
Diffstat (limited to 'src/rhlibrary/main.go')
-rw-r--r--src/rhlibrary/main.go14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/rhlibrary/main.go b/src/rhlibrary/main.go
index 8221091..91e5790 100644
--- a/src/rhlibrary/main.go
+++ b/src/rhlibrary/main.go
@@ -30,6 +30,7 @@ import (
"io/ioutil"
"log"
"os"
+ "os/user"
"code.helsinki.at/rhrd-go/player"
"code.helsinki.at/rhrd-go/rddb"
@@ -37,14 +38,20 @@ import (
)
var (
- rhl = log.New(os.Stderr, "[rhlibrary]\t", log.LstdFlags)
- rhdl = log.New(ioutil.Discard, "[rhlibrary-dbg]\t", log.LstdFlags)
+ rhl = log.New(os.Stderr, "[rhlibrary]\t", log.LstdFlags)
+ rhdl = log.New(ioutil.Discard, "[rhlibrary-dbg]\t", log.LstdFlags)
+ rhuser *user.User
)
func init() {
// if _, exists := os.LookupEnv("RHLIBRARY_DEBUG"); exists {
rhdl.SetOutput(os.Stderr)
// }
+
+ var err error
+ if rhuser, err = user.Current(); err != nil {
+ panic(fmt.Sprintf("can't fetch current user: %s", err.Error()))
+ }
}
type envStringValue string
@@ -97,6 +104,9 @@ func main() {
rhl.Println("Error initializing Main Window:", err)
return
}
+
+
+ rhl.Printf("rhlibrary started as user: %s", rhuser.Username)
mw.ShowAndRun()
gtk.Main()