[MM-35454] Fix default downloads path for Windows and Linux, only set for the app if the path is not blank (#1583) (#1586)
* [MM-35454] Fix default downloads path for Windows and Linux, only set for the app if the path is not blank * Default all other OSes other than Mac/Windows to unix standard
This commit is contained in:
parent
87f7fbf220
commit
155d4fcdab
|
@ -6,6 +6,18 @@
|
||||||
* Default user preferences. End-users can change these parameters by editing config.json
|
* Default user preferences. End-users can change these parameters by editing config.json
|
||||||
* @param {number} version - Scheme version. (Not application version)
|
* @param {number} version - Scheme version. (Not application version)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
const getDefaultDownloadLocation = () => {
|
||||||
|
switch (process.platform) {
|
||||||
|
case 'darwin':
|
||||||
|
return `/Users/${process.env.USER || process.env.USERNAME}/Downloads`;
|
||||||
|
case 'win32':
|
||||||
|
return `C:\\Users\\${process.env.USER || process.env.USERNAME}\\Downloads`;
|
||||||
|
default:
|
||||||
|
return `/home/${process.env.USER || process.env.USERNAME}/Downloads`;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const defaultPreferences = {
|
const defaultPreferences = {
|
||||||
version: 2,
|
version: 2,
|
||||||
teams: [],
|
teams: [],
|
||||||
|
@ -23,7 +35,7 @@ const defaultPreferences = {
|
||||||
autostart: true,
|
autostart: true,
|
||||||
spellCheckerLocale: 'en-US',
|
spellCheckerLocale: 'en-US',
|
||||||
darkMode: false,
|
darkMode: false,
|
||||||
downloadLocation: `/Users/${process.env.USER || process.env.USERNAME}/Downloads`,
|
downloadLocation: getDefaultDownloadLocation(),
|
||||||
};
|
};
|
||||||
|
|
||||||
export default defaultPreferences;
|
export default defaultPreferences;
|
||||||
|
|
|
@ -257,7 +257,9 @@ function handleConfigSynchronize() {
|
||||||
// TODO: send this to server manager
|
// TODO: send this to server manager
|
||||||
WindowManager.setConfig(config.data);
|
WindowManager.setConfig(config.data);
|
||||||
setUnreadBadgeSetting(config.data.showUnreadBadge);
|
setUnreadBadgeSetting(config.data.showUnreadBadge);
|
||||||
|
if (config.data.downloadLocation) {
|
||||||
app.setPath('downloads', config.data.downloadLocation);
|
app.setPath('downloads', config.data.downloadLocation);
|
||||||
|
}
|
||||||
if (app.isReady()) {
|
if (app.isReady()) {
|
||||||
WindowManager.sendToRenderer(RELOAD_CONFIGURATION);
|
WindowManager.sendToRenderer(RELOAD_CONFIGURATION);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue