This commit is contained in:
leejinho 2020-01-31 15:25:40 +09:00
commit 52bd202c6a
4 changed files with 26 additions and 14 deletions

View File

@ -600,12 +600,21 @@ ipcMain.on(
ipcMain.on(
FileChannel.SelectSaveFilePath,
(event: IpcMainEvent, ...args: any[]) => {
const defaultPath = args[0];
const ext = path.extname(defaultPath);
dialog
.showSaveDialog({ defaultPath: args[0] })
.showSaveDialog({
defaultPath
})
.then(obj => {
const filePath =
'' !== ext && '' === path.extname(obj.filePath)
? `${obj.filePath}${ext}`
: obj.filePath;
event.returnValue = {
canceled: obj.canceled,
filePath: obj.filePath
filePath
};
})
.catch(obj => {

View File

@ -918,19 +918,20 @@ export class MessagesComponent implements OnInit, OnDestroy, AfterViewInit {
this.nativeService
.selectSaveFilePath(value.fileInfo.fileName)
.then(result => {
if (!!result && result.filePath.length > 0) {
this.saveFile(value, result.filePath);
if (!result) {
return;
}
if (result.canceled) {
this.snackBarService.open(
this.translateService.instant('common.file.results.canceled'),
this.translateService.instant('common.file.errors.label'),
{
duration: 1000
}
);
} else {
if (!!result && result.canceled) {
// ignore..
} else {
this.snackBarService.open(
this.translateService.instant(
'common.file.errors.failToSpecifyPath'
),
this.translateService.instant('common.file.errors.label')
);
}
this.saveFile(value, result.filePath);
}
})
.catch(reason => {

View File

@ -408,6 +408,7 @@
"saved": "The file has been saved.",
"savedAll": "All file(s) have(has) been saved.",
"savedToPath": "The file has been saved to path[{{path}}].",
"canceled": "Canceled",
"downloadInProgress": "Download is in progress."
},
"errors": {

View File

@ -408,6 +408,7 @@
"saved": "파일이 저장되었습니다.",
"savedAll": "모든 파일이 저장되었습니다.",
"savedToPath": "파일이 경로[{{path}}]에 저장되었습니다.",
"canceled": "취소 되었습니다.",
"downloadInProgress": "다운로드가 진행중입니다."
},
"errors": {