Fixed config loading, some formatting
This commit is contained in:
parent
687bef93c9
commit
e7afe60331
|
@ -9,6 +9,9 @@ package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"code.google.com/p/gcfg"
|
"code.google.com/p/gcfg"
|
||||||
|
"errors"
|
||||||
|
"fmt"
|
||||||
|
"os/user"
|
||||||
)
|
)
|
||||||
|
|
||||||
type DjConfig struct {
|
type DjConfig struct {
|
||||||
|
@ -42,6 +45,11 @@ type DjConfig struct {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func loadConfiguration() (error) {
|
func loadConfiguration() error {
|
||||||
return gcfg.ReadFileInto(&dj.conf, "mumbledj.gcfg")
|
usr, err := user.Current()
|
||||||
|
if err == nil {
|
||||||
|
return gcfg.ReadFileInto(&dj.conf, fmt.Sprintf("%s/.mumbledj/config/mumbledj.gcfg", usr.HomeDir))
|
||||||
|
} else {
|
||||||
|
return errors.New("Configuration load failed.")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue