bugfix ::
1. 파일다운로드 문제 수정. 2. 다운로드폴더 열기 문제 수정.
This commit is contained in:
parent
2bd3e42cc7
commit
7cb1f44562
|
@ -538,12 +538,19 @@ ipcMain.on(
|
|||
const fileName: string = args[1];
|
||||
const mimeType: string = args[2];
|
||||
const customSavePath: string = args[3];
|
||||
let savePath: string = path.join(
|
||||
!!appStorage.downloadPath
|
||||
? appStorage.downloadPath
|
||||
: app.getPath('downloads'),
|
||||
fileName
|
||||
);
|
||||
|
||||
let basePath = app.getPath('downloads');
|
||||
if (!!appStorage.downloadPath) {
|
||||
try {
|
||||
fse.mkdirpSync(appStorage.downloadPath);
|
||||
basePath = appStorage.downloadPath;
|
||||
} catch (err) {
|
||||
log.error(err);
|
||||
basePath = app.getPath('downloads');
|
||||
}
|
||||
}
|
||||
let savePath: string = path.join(basePath, fileName);
|
||||
|
||||
if (!!customSavePath) {
|
||||
savePath = customSavePath;
|
||||
} else {
|
||||
|
@ -554,12 +561,12 @@ ipcMain.on(
|
|||
if (!err) {
|
||||
event.returnValue = savePath;
|
||||
} else {
|
||||
log.info('SaveFile err', err);
|
||||
log.error('SaveFile err', err);
|
||||
event.returnValue = undefined;
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
log.info('SaveFile error', error);
|
||||
log.error('SaveFile error', error);
|
||||
event.returnValue = undefined;
|
||||
}
|
||||
}
|
||||
|
@ -572,15 +579,25 @@ ipcMain.on(
|
|||
let folderItem: string = args[0];
|
||||
const make: boolean = args[1];
|
||||
if (!folderItem) {
|
||||
folderItem = app.getPath('downloads');
|
||||
let basePath = app.getPath('downloads');
|
||||
if (!!appStorage.downloadPath) {
|
||||
try {
|
||||
basePath = appStorage.downloadPath;
|
||||
} catch (err) {
|
||||
log.error(err);
|
||||
basePath = app.getPath('downloads');
|
||||
}
|
||||
}
|
||||
|
||||
folderItem = basePath;
|
||||
} else {
|
||||
if (make) {
|
||||
fse.mkdirpSync(folderItem);
|
||||
}
|
||||
}
|
||||
|
||||
let isSuccess = true;
|
||||
if (make) {
|
||||
fse.ensureDirSync(folderItem);
|
||||
}
|
||||
|
||||
if (isSuccess && fse.existsSync(folderItem)) {
|
||||
if (fse.existsSync(folderItem)) {
|
||||
shell.openItem(folderItem);
|
||||
} else {
|
||||
isSuccess = false;
|
||||
|
|
|
@ -23,6 +23,7 @@ import { environment } from '../../environments/environment';
|
|||
import { AppUserInfo, KEY_APP_USER_INFO } from '@app/types/app-user-info.type';
|
||||
import { Settings } from '@ucap-webmessenger/ui-settings';
|
||||
import { NativeService, UCAP_NATIVE_SERVICE } from '@ucap-webmessenger/native';
|
||||
import { join } from 'path';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
|
@ -71,9 +72,10 @@ export class AppAuthenticationService {
|
|||
...environment.productConfig.defaultSettings,
|
||||
chat: {
|
||||
...environment.productConfig.defaultSettings.chat,
|
||||
downloadPath: `${await this.nativeService.getPath(
|
||||
'documents'
|
||||
)}/Messenger downloads`
|
||||
downloadPath: join(
|
||||
await this.nativeService.getPath('documents'),
|
||||
'MessengerDownloads'
|
||||
)
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -119,11 +121,11 @@ export class AppAuthenticationService {
|
|||
appUserInfo = {
|
||||
...appUserInfo,
|
||||
settings: {
|
||||
...appUserInfo.settings,
|
||||
general: {
|
||||
...appUserInfo.settings.general,
|
||||
autoLogin: false
|
||||
}
|
||||
...appUserInfo.settings,
|
||||
general: {
|
||||
...appUserInfo.settings.general,
|
||||
autoLogin: false
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user