Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

feat(desktop): add openRecordingFolder utility

Richie McIlroy44fc49f73bbe
diff --git a/apps/desktop/src/utils/recording.ts b/apps/desktop/src/utils/recording.ts
index 5810d2847..ce1ef9f06 100644
--- a/apps/desktop/src/utils/recording.ts
+++ b/apps/desktop/src/utils/recording.ts
@@ -1,7 +1,8 @@
import { emit } from "@tauri-apps/api/event";
import * as dialog from "@tauri-apps/plugin-dialog";
+import { revealItemInDir } from "@tauri-apps/plugin-opener";
import type { createOptionsQuery } from "./queries";
-import { commands, type RecordingAction } from "./tauri";
+import { commands, type RecordingAction, type RecordingMode } from "./tauri";
export function handleRecordingResult(
result: Promise<RecordingAction>,
@@ -49,3 +50,21 @@ export function handleRecordingResult(
}),
);
}
+
+export async function openRecordingFolder(
+ projectPath: string,
+ mode: RecordingMode,
+) {
+ const path = projectPath.replace(/[/\\]+$/, "");
+
+ const openedContent =
+ mode === "instant" &&
+ (await commands.openFilePath(`${path}/content`).then(
+ () => true,
+ () => false,
+ ));
+
+ if (openedContent) return;
+
+ await revealItemInDir(`${path}/`);
+}