@@ -2,6 +2,9 @@
|
|||||||
// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
|
// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
|
||||||
// See LICENSE.txt for license information.
|
// See LICENSE.txt for license information.
|
||||||
|
|
||||||
|
import path from 'path';
|
||||||
|
import os from 'os';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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)
|
||||||
@@ -9,15 +12,8 @@
|
|||||||
|
|
||||||
import {ConfigV2} from 'types/config';
|
import {ConfigV2} from 'types/config';
|
||||||
|
|
||||||
export const getDefaultDownloadLocation = () => {
|
export const getDefaultDownloadLocation = (): string => {
|
||||||
switch (process.platform) {
|
return path.join(os.homedir(), 'Downloads');
|
||||||
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: ConfigV2 = {
|
const defaultPreferences: ConfigV2 = {
|
||||||
|
@@ -282,7 +282,11 @@ function handleConfigSynchronize() {
|
|||||||
WindowManager.setConfig(config.data);
|
WindowManager.setConfig(config.data);
|
||||||
setUnreadBadgeSetting(config.data.showUnreadBadge);
|
setUnreadBadgeSetting(config.data.showUnreadBadge);
|
||||||
if (config.data.downloadLocation) {
|
if (config.data.downloadLocation) {
|
||||||
|
try {
|
||||||
app.setPath('downloads', config.data.downloadLocation);
|
app.setPath('downloads', config.data.downloadLocation);
|
||||||
|
} catch (e) {
|
||||||
|
log.error(`There was a problem trying to set the default download path: ${e}`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (app.isReady()) {
|
if (app.isReady()) {
|
||||||
WindowManager.sendToRenderer(RELOAD_CONFIGURATION);
|
WindowManager.sendToRenderer(RELOAD_CONFIGURATION);
|
||||||
|
Reference in New Issue
Block a user