Skip to content

The swiss army knife of lossless video/audio editing

Open project/subtitle import dialog in the video's folder

Claude88e7a8628e30
diff --git a/src/renderer/src/App.tsx b/src/renderer/src/App.tsx
index d3a6c817..901dfb83 100644
--- a/src/renderer/src/App.tsx
+++ b/src/renderer/src/App.tsx
@@ -84,6 +84,7 @@ import {
getOutFileExtension,
getSuffixedOutPath,
calculateTimelinePercent,
+ getFileDir,
} from './util';
import getSwal, { errorToast, showPlaybackFailedMessage } from './swal';
import { adjustRate } from './util/rate-calculator';
@@ -2345,10 +2346,10 @@ function App() {
if (!checkFileOpened()) return;
await withErrorHandling(async () => {
- const edl = await askForEdlImport({ type, fps: detectedFps, fileDuration });
+ const edl = await askForEdlImport({ type, fps: detectedFps, fileDuration, defaultPath: type === 'llc' ? getOutDir(customOutDir, filePath) : getFileDir(filePath) });
if (edl.length > 0) loadCutSegments({ segments: edl, append: true, clampDuration: fileDuration });
}, i18n.t('Failed to import project file'));
- }, [checkFileOpened, detectedFps, fileDuration, loadCutSegments, withErrorHandling]);
+ }, [checkFileOpened, customOutDir, detectedFps, fileDuration, filePath, loadCutSegments, withErrorHandling]);
useEffect(() => {
const openFiles = async (filePaths: string[]) => userOpenFiles(filePaths.map((p) => resolvePathIfNeeded(p)));
diff --git a/src/renderer/src/edlStore.ts b/src/renderer/src/edlStore.ts
index e9edf0e0..4dece99c 100644
--- a/src/renderer/src/edlStore.ts
+++ b/src/renderer/src/edlStore.ts
@@ -156,7 +156,7 @@ export async function readEdlFile({ type, path, fps }: {
throw new Error('Invalid EDL type');
}
-export async function askForEdlImport({ type, fps, fileDuration }: { type: EdlImportType, fps?: number | undefined, fileDuration?: number | undefined }) {
+export async function askForEdlImport({ type, fps, fileDuration, defaultPath }: { type: EdlImportType, fps?: number | undefined, fileDuration?: number | undefined, defaultPath?: string | undefined }) {
if (type === 'youtube') return askForYouTubeInput({ fileDuration });
let filters;
@@ -175,6 +175,7 @@ export async function askForEdlImport({ type, fps, fileDuration }: { type: EdlIm
properties: ['openFile'],
title: i18n.t('Import project'),
...(filters && { filters }),
+ ...(defaultPath != null && { defaultPath }),
});
const [firstFilePath] = filePaths;
if (canceled || firstFilePath == null) return [];