diff options
author | André Oliveira <37463445+SpecialAro@users.noreply.github.com> | 2024-05-06 14:56:26 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-06 19:26:26 +0530 |
commit | fd8885b869808936ab58c492e9ce602bfe3c3713 (patch) | |
tree | f71737871033539fa54f5504f4c6234829e8cd28 /src/index.ts | |
parent | Refactor context menu to be more consistent across all contexts (#1745) (diff) | |
download | ferdium-app-fd8885b869808936ab58c492e9ce602bfe3c3713.tar.gz ferdium-app-fd8885b869808936ab58c492e9ce602bfe3c3713.tar.zst ferdium-app-fd8885b869808936ab58c492e9ce602bfe3c3713.zip |
feat: default download path as a user preference (#1746)
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 | ||