[MM-35984] Make sure Select Downloads Folder dialog always uses the default location if none is selected (#1613)

This commit is contained in:
Devin Binnie
2021-05-26 10:15:04 -04:00
committed by GitHub
parent eecadb9c46
commit 9eb61c6cc0
2 changed files with 2 additions and 2 deletions

View File

@@ -621,7 +621,7 @@ function handleUpdateMenuEvent(event, menuConfig) {
async function handleSelectDownload(event, startFrom) { async function handleSelectDownload(event, startFrom) {
const message = 'Specify the folder where files will download'; 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, message,
properties: properties:
['openDirectory', 'createDirectory', 'dontAddToRecent', 'promptToCreate']}); ['openDirectory', 'createDirectory', 'dontAddToRecent', 'promptToCreate']});

View File

@@ -279,7 +279,7 @@ export default class SettingsPage extends React.PureComponent {
selectDownloadLocation = () => { selectDownloadLocation = () => {
if (!this.state.userOpenedDownloadDialog) { 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: true});
} }
this.setState({userOpenedDownloadDialog: false}); this.setState({userOpenedDownloadDialog: false});