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