[ISSUE 197] bug fixed

This commit is contained in:
richard-loafle 2020-01-31 14:46:47 +09:00
parent ba07dc585e
commit e2e34800a0

View File

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