diff options
author | Tulir Asokan <tulir@maunium.net> | 2020-04-08 15:49:42 +0300 |
---|---|---|
committer | Tulir Asokan <tulir@maunium.net> | 2020-04-08 15:49:42 +0300 |
commit | 79b61b86c9b5cd403c5ff3efcaf5a7237a1c07c7 (patch) | |
tree | 521b0ed709cab428e463d15d69a3a6f40358853c /main.go | |
parent | a6f6fb3ef22658508671296a31367a198205da99 (diff) |
Use $HOME/Downloads as default download directory
TODO: Get the default directory properly with XDG
Diffstat (limited to 'main.go')
-rw-r--r-- | main.go | 13 |
1 files changed, 12 insertions, 1 deletions
@@ -58,8 +58,14 @@ func main() { fmt.Fprintln(os.Stderr, "Failed to get cache directory:", err) os.Exit(3) } + downloadDir, err := UserDownloadDir() + if err != nil { + fmt.Fprintln(os.Stderr, "Failed to get download directory:", err) + os.Exit(3) + } - gmx := NewGomuks(MainUIProvider, configDir, cacheDir) + + gmx := NewGomuks(MainUIProvider, configDir, cacheDir, downloadDir) gmx.Start() // We use os.Exit() everywhere, so exiting by returning from Start() shouldn't happen. @@ -77,6 +83,11 @@ func UserCacheDir() (dir string, err error) { return } +func UserDownloadDir() (dir string, err error) { + dir = os.Getenv("HOME") + return filepath.Join(dir, "Downloads"), nil +} + func UserConfigDir() (dir string, err error) { dir = os.Getenv("GOMUKS_CONFIG_HOME") if dir != "" { |