bugfix :: 기본 다운로드 폴더 수정.

This commit is contained in:
leejinho 2020-02-17 19:11:11 +09:00
parent 20cad5daa6
commit 25095369b2
8 changed files with 29 additions and 10 deletions

View File

@ -539,15 +539,18 @@ ipcMain.on(
const mimeType: string = args[2];
const customSavePath: string = args[3];
let basePath = app.getPath('downloads');
let basePath = path.join(
app.getPath('documents'),
appStorage.constDefaultDownloadFolder
);
if (!!appStorage.downloadPath) {
try {
fse.mkdirpSync(appStorage.downloadPath);
basePath = appStorage.downloadPath;
} catch (err) {
log.error(err);
basePath = app.getPath('downloads');
}
basePath = appStorage.downloadPath;
}
try {
fse.mkdirpSync(basePath);
} catch (err) {
log.error(err);
basePath = app.getPath('downloads');
}
let savePath: string = path.join(basePath, fileName);

View File

@ -1,8 +1,10 @@
import ElectronStore from 'electron-store';
import { app } from 'electron';
import path from 'path';
const STORE_KEY_STARTUPHIDEWINDOW = 'options.startupHideWindow';
const STORE_KEY_DOWNLOADFOLDER = 'options.downloadPath';
const DOWNLOAD_FOLDER_PATH = 'DS Talk Download';
export class Storage {
private readonly store: ElectronStore<any>;
@ -22,7 +24,10 @@ export class Storage {
},
default: {
startupHideWindow: false,
downloadPath: app.getPath('downloads')
downloadPath: path.join(
app.getPath('documents'),
DOWNLOAD_FOLDER_PATH
)
}
}
},
@ -44,6 +49,10 @@ export class Storage {
set downloadPath(downloadPath: string) {
this.store.set(STORE_KEY_DOWNLOADFOLDER, downloadPath);
}
get constDefaultDownloadFolder(): string {
return DOWNLOAD_FOLDER_PATH;
}
}
export const appStorage: Storage = new Storage();

View File

@ -74,12 +74,13 @@ export class AppAuthenticationService {
...environment.productConfig.defaultSettings.chat,
downloadPath: join(
await this.nativeService.getPath('documents'),
'MessengerDownloads'
environment.productConfig.CommonSetting.defaultDownloadFolder
)
}
}
};
}
console.log(appUserInfo);
appUserInfo = {
...appUserInfo,

View File

@ -66,6 +66,7 @@ export const environment: Environment = {
}
},
CommonSetting: {
defaultDownloadFolder: 'DS Talk Download',
defaultFileAllowSize: 100,
editableProfileImage: false,

View File

@ -66,6 +66,7 @@ export const environment: Environment = {
}
},
CommonSetting: {
defaultDownloadFolder: 'DS Talk Download',
defaultFileAllowSize: 100,
editableProfileImage: false,

View File

@ -66,6 +66,7 @@ export const environment: Environment = {
}
},
CommonSetting: {
defaultDownloadFolder: 'MessengerDownloads',
defaultFileAllowSize: 100,
editableProfileImage: true,

View File

@ -66,6 +66,7 @@ export const environment: Environment = {
}
},
CommonSetting: {
defaultDownloadFolder: 'MessengerDownloads',
defaultFileAllowSize: 100,
editableProfileImage: true,

View File

@ -64,6 +64,8 @@ export interface Environment {
defaultSettings: Settings;
CommonSetting: {
/** 기본 다운로드 경로 */
defaultDownloadFolder: string;
/** 파일업로드 제한 사이즈 (mb) */
defaultFileAllowSize: number;