feat: seprate os and docker default download dir

This commit is contained in:
Simon Ding
2025-08-31 23:25:33 +08:00
parent 94b4db3310
commit 05d114be66
2 changed files with 43 additions and 1 deletions

View File

@@ -62,7 +62,17 @@ func (c *client) init() {
downloadDir := c.GetSetting(SettingDownloadDir)
if downloadDir == "" {
log.Infof("set default download dir")
c.SetSetting(SettingDownloadDir, "/downloads")
if utils.IsRunningInDocker() {
c.SetSetting(SettingDownloadDir, "/downloads")
} else {
downloadDir, err := utils.UserDownloadDir()
if err != nil {
log.Errorf("get user download dir error: %v", err)
downloadDir = "/downloads"
}
c.SetSetting(SettingDownloadDir, downloadDir)
}
}
logLevel := c.GetSetting(SettingLogLevel)
if logLevel == "" {