diff options
Diffstat (limited to 'src/index.ts')
-rw-r--r-- | src/index.ts | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/index.ts b/src/index.ts index cccf0ef66..09e411e13 100644 --- a/src/index.ts +++ b/src/index.ts | |||
@@ -245,6 +245,18 @@ const createWindow = () => { | |||
245 | openExternalUrl(url); | 245 | openExternalUrl(url); |
246 | return { action: 'deny' }; | 246 | return { action: 'deny' }; |
247 | }); | 247 | }); |
248 | |||
249 | // Handle will download event from main process (prevent download dialog) | ||
250 | contents.session.on('will-download', (_e, item) => { | ||
251 | const downloadFolderPath = retrieveSettingValue( | ||
252 | 'downloadFolderPath', | ||
253 | DEFAULT_APP_SETTINGS.downloadFolderPath, | ||
254 | ) as string; | ||
255 | |||
256 | if (downloadFolderPath !== '') { | ||
257 | item.setSavePath(join(downloadFolderPath, item.getFilename())); | ||
258 | } | ||
259 | }); | ||
248 | } | 260 | } |
249 | }); | 261 | }); |
250 | 262 | ||