mirror of
https://github.com/mumble-voip/grumble.git
synced 2025-12-20 06:10:00 -08:00
Merge PR #16: Use %USERPROFILE% instead of $HOME on Windows for Grumble's default data dir.
This commit is contained in:
commit
f53f5b7e00
1 changed files with 14 additions and 11 deletions
|
|
@ -13,6 +13,7 @@ type UsageArgs struct {
|
|||
BuildDate string
|
||||
OS string
|
||||
Arch string
|
||||
DefaultDataDir string
|
||||
}
|
||||
|
||||
var usageTmpl = `usage: grumble [options]
|
||||
|
|
@ -23,7 +24,7 @@ var usageTmpl = `usage: grumble [options]
|
|||
--help
|
||||
Shows this help listing.
|
||||
|
||||
--datadir <data-dir> (default: $HOME/.grumble)
|
||||
--datadir <data-dir> (default: {{.DefaultDataDir}})
|
||||
Directory to use for server storage.
|
||||
|
||||
--log <log-path> (default: $DATADIR/grumble.log)
|
||||
|
|
@ -54,11 +55,12 @@ type args struct {
|
|||
}
|
||||
|
||||
func defaultDataDir() string {
|
||||
homedir := os.Getenv("HOME")
|
||||
dirname := ".grumble"
|
||||
if runtime.GOOS == "windows" {
|
||||
dirname = "grumble"
|
||||
homedir = os.Getenv("USERPROFILE")
|
||||
}
|
||||
return filepath.Join(os.Getenv("HOME"), dirname)
|
||||
return filepath.Join(homedir, dirname)
|
||||
}
|
||||
|
||||
func defaultLogPath() string {
|
||||
|
|
@ -76,6 +78,7 @@ func Usage() {
|
|||
BuildDate: buildDate,
|
||||
OS: runtime.GOOS,
|
||||
Arch: runtime.GOARCH,
|
||||
DefaultDataDir: defaultDataDir(),
|
||||
})
|
||||
if err != nil {
|
||||
panic("unable to execute usage template")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue