bugfix :: 기본 다운로드 폴더 수정.
This commit is contained in:
parent
20cad5daa6
commit
25095369b2
|
@ -539,16 +539,19 @@ ipcMain.on(
|
||||||
const mimeType: string = args[2];
|
const mimeType: string = args[2];
|
||||||
const customSavePath: string = args[3];
|
const customSavePath: string = args[3];
|
||||||
|
|
||||||
let basePath = app.getPath('downloads');
|
let basePath = path.join(
|
||||||
|
app.getPath('documents'),
|
||||||
|
appStorage.constDefaultDownloadFolder
|
||||||
|
);
|
||||||
if (!!appStorage.downloadPath) {
|
if (!!appStorage.downloadPath) {
|
||||||
try {
|
|
||||||
fse.mkdirpSync(appStorage.downloadPath);
|
|
||||||
basePath = appStorage.downloadPath;
|
basePath = appStorage.downloadPath;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
fse.mkdirpSync(basePath);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
log.error(err);
|
log.error(err);
|
||||||
basePath = app.getPath('downloads');
|
basePath = app.getPath('downloads');
|
||||||
}
|
}
|
||||||
}
|
|
||||||
let savePath: string = path.join(basePath, fileName);
|
let savePath: string = path.join(basePath, fileName);
|
||||||
|
|
||||||
if (!!customSavePath) {
|
if (!!customSavePath) {
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
import ElectronStore from 'electron-store';
|
import ElectronStore from 'electron-store';
|
||||||
import { app } from 'electron';
|
import { app } from 'electron';
|
||||||
|
import path from 'path';
|
||||||
|
|
||||||
const STORE_KEY_STARTUPHIDEWINDOW = 'options.startupHideWindow';
|
const STORE_KEY_STARTUPHIDEWINDOW = 'options.startupHideWindow';
|
||||||
const STORE_KEY_DOWNLOADFOLDER = 'options.downloadPath';
|
const STORE_KEY_DOWNLOADFOLDER = 'options.downloadPath';
|
||||||
|
const DOWNLOAD_FOLDER_PATH = 'DS Talk Download';
|
||||||
|
|
||||||
export class Storage {
|
export class Storage {
|
||||||
private readonly store: ElectronStore<any>;
|
private readonly store: ElectronStore<any>;
|
||||||
|
@ -22,7 +24,10 @@ export class Storage {
|
||||||
},
|
},
|
||||||
default: {
|
default: {
|
||||||
startupHideWindow: false,
|
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) {
|
set downloadPath(downloadPath: string) {
|
||||||
this.store.set(STORE_KEY_DOWNLOADFOLDER, downloadPath);
|
this.store.set(STORE_KEY_DOWNLOADFOLDER, downloadPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get constDefaultDownloadFolder(): string {
|
||||||
|
return DOWNLOAD_FOLDER_PATH;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const appStorage: Storage = new Storage();
|
export const appStorage: Storage = new Storage();
|
||||||
|
|
|
@ -74,12 +74,13 @@ export class AppAuthenticationService {
|
||||||
...environment.productConfig.defaultSettings.chat,
|
...environment.productConfig.defaultSettings.chat,
|
||||||
downloadPath: join(
|
downloadPath: join(
|
||||||
await this.nativeService.getPath('documents'),
|
await this.nativeService.getPath('documents'),
|
||||||
'MessengerDownloads'
|
environment.productConfig.CommonSetting.defaultDownloadFolder
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
console.log(appUserInfo);
|
||||||
|
|
||||||
appUserInfo = {
|
appUserInfo = {
|
||||||
...appUserInfo,
|
...appUserInfo,
|
||||||
|
|
|
@ -66,6 +66,7 @@ export const environment: Environment = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
CommonSetting: {
|
CommonSetting: {
|
||||||
|
defaultDownloadFolder: 'DS Talk Download',
|
||||||
defaultFileAllowSize: 100,
|
defaultFileAllowSize: 100,
|
||||||
|
|
||||||
editableProfileImage: false,
|
editableProfileImage: false,
|
||||||
|
|
|
@ -66,6 +66,7 @@ export const environment: Environment = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
CommonSetting: {
|
CommonSetting: {
|
||||||
|
defaultDownloadFolder: 'DS Talk Download',
|
||||||
defaultFileAllowSize: 100,
|
defaultFileAllowSize: 100,
|
||||||
|
|
||||||
editableProfileImage: false,
|
editableProfileImage: false,
|
||||||
|
|
|
@ -66,6 +66,7 @@ export const environment: Environment = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
CommonSetting: {
|
CommonSetting: {
|
||||||
|
defaultDownloadFolder: 'MessengerDownloads',
|
||||||
defaultFileAllowSize: 100,
|
defaultFileAllowSize: 100,
|
||||||
|
|
||||||
editableProfileImage: true,
|
editableProfileImage: true,
|
||||||
|
|
|
@ -66,6 +66,7 @@ export const environment: Environment = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
CommonSetting: {
|
CommonSetting: {
|
||||||
|
defaultDownloadFolder: 'MessengerDownloads',
|
||||||
defaultFileAllowSize: 100,
|
defaultFileAllowSize: 100,
|
||||||
|
|
||||||
editableProfileImage: true,
|
editableProfileImage: true,
|
||||||
|
|
|
@ -64,6 +64,8 @@ export interface Environment {
|
||||||
defaultSettings: Settings;
|
defaultSettings: Settings;
|
||||||
|
|
||||||
CommonSetting: {
|
CommonSetting: {
|
||||||
|
/** 기본 다운로드 경로 */
|
||||||
|
defaultDownloadFolder: string;
|
||||||
/** 파일업로드 제한 사이즈 (mb) */
|
/** 파일업로드 제한 사이즈 (mb) */
|
||||||
defaultFileAllowSize: number;
|
defaultFileAllowSize: number;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user