diff --git a/electron-projects/ucap-webmessenger-electron/src/index.ts b/electron-projects/ucap-webmessenger-electron/src/index.ts index b510b68f..ed3c3bda 100644 --- a/electron-projects/ucap-webmessenger-electron/src/index.ts +++ b/electron-projects/ucap-webmessenger-electron/src/index.ts @@ -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); diff --git a/electron-projects/ucap-webmessenger-electron/src/lib/storage.ts b/electron-projects/ucap-webmessenger-electron/src/lib/storage.ts index 0956accf..a4fe91cf 100644 --- a/electron-projects/ucap-webmessenger-electron/src/lib/storage.ts +++ b/electron-projects/ucap-webmessenger-electron/src/lib/storage.ts @@ -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; @@ -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(); diff --git a/projects/ucap-webmessenger-app/src/app/services/authentication.service.ts b/projects/ucap-webmessenger-app/src/app/services/authentication.service.ts index ef5726ca..0995ea37 100644 --- a/projects/ucap-webmessenger-app/src/app/services/authentication.service.ts +++ b/projects/ucap-webmessenger-app/src/app/services/authentication.service.ts @@ -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, diff --git a/projects/ucap-webmessenger-app/src/environments/environment.daesang.dev.ts b/projects/ucap-webmessenger-app/src/environments/environment.daesang.dev.ts index a2becfdf..74d15095 100644 --- a/projects/ucap-webmessenger-app/src/environments/environment.daesang.dev.ts +++ b/projects/ucap-webmessenger-app/src/environments/environment.daesang.dev.ts @@ -66,6 +66,7 @@ export const environment: Environment = { } }, CommonSetting: { + defaultDownloadFolder: 'DS Talk Download', defaultFileAllowSize: 100, editableProfileImage: false, diff --git a/projects/ucap-webmessenger-app/src/environments/environment.daesang.prod.ts b/projects/ucap-webmessenger-app/src/environments/environment.daesang.prod.ts index 91d4af5b..86f7a7bb 100644 --- a/projects/ucap-webmessenger-app/src/environments/environment.daesang.prod.ts +++ b/projects/ucap-webmessenger-app/src/environments/environment.daesang.prod.ts @@ -66,6 +66,7 @@ export const environment: Environment = { } }, CommonSetting: { + defaultDownloadFolder: 'DS Talk Download', defaultFileAllowSize: 100, editableProfileImage: false, diff --git a/projects/ucap-webmessenger-app/src/environments/environment.dev.ts b/projects/ucap-webmessenger-app/src/environments/environment.dev.ts index 7bf13d35..7d38e111 100644 --- a/projects/ucap-webmessenger-app/src/environments/environment.dev.ts +++ b/projects/ucap-webmessenger-app/src/environments/environment.dev.ts @@ -66,6 +66,7 @@ export const environment: Environment = { } }, CommonSetting: { + defaultDownloadFolder: 'MessengerDownloads', defaultFileAllowSize: 100, editableProfileImage: true, diff --git a/projects/ucap-webmessenger-app/src/environments/environment.prod.ts b/projects/ucap-webmessenger-app/src/environments/environment.prod.ts index 2021e052..7685a2f1 100644 --- a/projects/ucap-webmessenger-app/src/environments/environment.prod.ts +++ b/projects/ucap-webmessenger-app/src/environments/environment.prod.ts @@ -66,6 +66,7 @@ export const environment: Environment = { } }, CommonSetting: { + defaultDownloadFolder: 'MessengerDownloads', defaultFileAllowSize: 100, editableProfileImage: true, diff --git a/projects/ucap-webmessenger-app/src/environments/environment.type.ts b/projects/ucap-webmessenger-app/src/environments/environment.type.ts index a7e6abac..a93df23f 100644 --- a/projects/ucap-webmessenger-app/src/environments/environment.type.ts +++ b/projects/ucap-webmessenger-app/src/environments/environment.type.ts @@ -64,6 +64,8 @@ export interface Environment { defaultSettings: Settings; CommonSetting: { + /** 기본 다운로드 경로 */ + defaultDownloadFolder: string; /** 파일업로드 제한 사이즈 (mb) */ defaultFileAllowSize: number;