From ff65a011da2480704782c1e1173dc4f79879a6d9 Mon Sep 17 00:00:00 2001 From: Mantas-2155X <13873974+Mantas-2155X@users.noreply.github.com> Date: Sat, 21 May 2022 20:04:20 +0300 Subject: [PATCH] Save downloaded torrents to your Downloads dir instead of home dir --- tui/torrent.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tui/torrent.go b/tui/torrent.go index c0f5de8..137504e 100644 --- a/tui/torrent.go +++ b/tui/torrent.go @@ -6,6 +6,7 @@ import ( "net/http" "os" "os/exec" + "path/filepath" "runtime" "strings" "time" @@ -151,7 +152,12 @@ func downloadTorrents(torrents []t.MarkedTorrent, provider string) ([]string, er fileName = v.TorrentCell.Text } - out, err := os.Create(fileName + ".torrent") + var homeDir, hErr = os.UserHomeDir() + if hErr != nil { + log.Fatal(hErr) + } + + out, err := os.Create(filepath.Join(homeDir, "Downloads", fileName) + ".torrent") if err != nil { log.Fatal(err) }