From be6a2627ae97fa12a5a5caf36a81f997ffabcfba Mon Sep 17 00:00:00 2001 From: Mikael Finstad Date: Tue, 3 Jan 2023 18:38:54 +0800 Subject: [PATCH] set default export save dialog path fixes #1393 --- src/App.jsx | 2 +- src/edlStore.js | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/App.jsx b/src/App.jsx index db479ab2..aa3ab71b 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -2243,7 +2243,7 @@ const App = memo(() => { async function exportEdlFile2(e, type) { if (!checkFileOpened()) return; try { - await exportEdlFile({ type, cutSegments, filePath, getFrameCount }); + await exportEdlFile({ type, cutSegments, customOutDir, filePath, getFrameCount }); } catch (err) { errorToast(i18n.t('Failed to export project')); console.error('Failed to export project', type, err); diff --git a/src/edlStore.js b/src/edlStore.js index 32a42ad0..d20120f4 100644 --- a/src/edlStore.js +++ b/src/edlStore.js @@ -3,6 +3,7 @@ import i18n from 'i18next'; import { parseCuesheet, parseXmeml, parseFcpXml, parseCsv, parsePbf, parseMplayerEdl, formatCsvHuman, formatTsv, formatCsvFrames, formatCsvSeconds, getTimeFromFrameNum } from './edlFormats'; import { askForYouTubeInput } from './dialogs'; +import { getOutPath } from './util'; const fs = window.require('fs-extra'); const cueParser = window.require('cue-parser'); @@ -101,7 +102,7 @@ export async function askForEdlImport({ type, fps }) { return readEdlFile({ type, path: filePaths[0], fps }); } -export async function exportEdlFile({ type, cutSegments, filePath, getFrameCount }) { +export async function exportEdlFile({ type, cutSegments, customOutDir, filePath, getFrameCount }) { let filters; let ext; if (type === 'csv') { @@ -121,7 +122,9 @@ export async function exportEdlFile({ type, cutSegments, filePath, getFrameCount filters = [{ name: i18n.t('LosslessCut project'), extensions: [ext, 'llc'] }]; } - const { canceled, filePath: savePath } = await dialog.showSaveDialog({ defaultPath: `${new Date().getTime()}.${ext}`, filters }); + const defaultPath = getOutPath({ filePath, customOutDir, fileName: `${new Date().getTime()}.${ext}` }); + + const { canceled, filePath: savePath } = await dialog.showSaveDialog({ defaultPath, filters }); if (canceled || !savePath) return; console.log('Saving', type, savePath); if (type === 'csv') await saveCsv(savePath, cutSegments);