Skip to content

Commit 4256de0

Browse files
committed
Save direct paths on button click, including failure
-wails autogen
1 parent 19b05ae commit 4256de0

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

app.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -470,6 +470,10 @@ func (a *App) SetConfigString(key string, value string) error {
470470
}
471471

472472
func (a *App) DirectDownload(url, directory, format string) (string, error) {
473+
// Save current used settings for next time
474+
_ = a.SettingsService.SetPreparsed("direct_download_last_path", directory)
475+
_ = a.SettingsService.SetPreparsed("direct_download_last_format", format)
476+
473477
// Export browser credentials before download if configured
474478
browserSource, err := a.SettingsService.GetSettingString("browser_credentials_source")
475479
if err == nil && browserSource != "" && browserSource != "none" {
@@ -498,10 +502,6 @@ func (a *App) DirectDownload(url, directory, format string) (string, error) {
498502
return "", err
499503
}
500504

501-
// Save last used settings for next time
502-
_ = a.SettingsService.SetPreparsed("direct_download_last_path", directory)
503-
_ = a.SettingsService.SetPreparsed("direct_download_last_format", format)
504-
505505
// Return final path
506506
return result.FinalFullPath, nil
507507
}

frontend/wailsjs/go/main/App.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ export function GetDaemonLogLinesWithLevel(arg1:number,arg2:string):Promise<Arra
2626

2727
export function GetDownloadHistoryPage(arg1:number,arg2:number,arg3:boolean,arg4:boolean,arg5:boolean):Promise<Array<download.Download>>;
2828

29+
export function GetDownloadsDirectory():Promise<string>;
30+
2931
export function GetLegalDisclaimerAccepted():Promise<boolean>;
3032

3133
export function GetRecentLogs():Promise<Array<any>>;

frontend/wailsjs/go/main/App.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ export function GetDownloadHistoryPage(arg1, arg2, arg3, arg4, arg5) {
4646
return window['go']['main']['App']['GetDownloadHistoryPage'](arg1, arg2, arg3, arg4, arg5);
4747
}
4848

49+
export function GetDownloadsDirectory() {
50+
return window['go']['main']['App']['GetDownloadsDirectory']();
51+
}
52+
4953
export function GetLegalDisclaimerAccepted() {
5054
return window['go']['main']['App']['GetLegalDisclaimerAccepted']();
5155
}

0 commit comments

Comments
 (0)