From 9eb61c6cc0dea43fa1074e8da9bec8a8f277cee5 Mon Sep 17 00:00:00 2001 From: Devin Binnie <52460000+devinbinnie@users.noreply.github.com> Date: Wed, 26 May 2021 10:15:04 -0400 Subject: [PATCH] [MM-35984] Make sure Select Downloads Folder dialog always uses the default location if none is selected (#1613) --- src/main/main.js | 2 +- src/renderer/components/SettingsPage.jsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/main.js b/src/main/main.js index d84d67aa..5c1c6d37 100644 --- a/src/main/main.js +++ b/src/main/main.js @@ -621,7 +621,7 @@ function handleUpdateMenuEvent(event, menuConfig) { async function handleSelectDownload(event, startFrom) { const message = 'Specify the folder where files will download'; - const result = await dialog.showOpenDialog({defaultPath: startFrom, + const result = await dialog.showOpenDialog({defaultPath: startFrom || config.data.downloadLocation, message, properties: ['openDirectory', 'createDirectory', 'dontAddToRecent', 'promptToCreate']}); diff --git a/src/renderer/components/SettingsPage.jsx b/src/renderer/components/SettingsPage.jsx index 49f81ba5..dd06c9b9 100644 --- a/src/renderer/components/SettingsPage.jsx +++ b/src/renderer/components/SettingsPage.jsx @@ -279,7 +279,7 @@ export default class SettingsPage extends React.PureComponent { selectDownloadLocation = () => { if (!this.state.userOpenedDownloadDialog) { - window.ipcRenderer.invoke(GET_DOWNLOAD_LOCATION, `/Users/${window.process.env.USER || window.process.env.USERNAME}/Downloads`).then((result) => this.saveDownloadLocation(result)); + window.ipcRenderer.invoke(GET_DOWNLOAD_LOCATION, this.state.downloadLocation).then((result) => this.saveDownloadLocation(result)); this.setState({userOpenedDownloadDialog: true}); } this.setState({userOpenedDownloadDialog: false});