Create polished demo videos without editing skills. Mac/Windows/Linux
fix(windows): bundle native capture helpers
webadderallb85374dee04b
diff --git a/electron/ipc/handlers.ts b/electron/ipc/handlers.tsindex 4aea0572..5cd55288 100644--- a/electron/ipc/handlers.ts+++ b/electron/ipc/handlers.ts@@ -1,6 +1,6 @@import type { ChildProcessWithoutNullStreams } from 'node:child_process'import { execFile, spawn, spawnSync } from 'node:child_process'-import { createWriteStream, constants as fsConstants } from 'node:fs'+import { createWriteStream, constants as fsConstants, existsSync } from 'node:fs'import fs from 'node:fs/promises'import { get as httpsGet } from 'node:https'import { createRequire } from 'node:module'@@ -712,6 +712,28 @@ function getPrebundledNativeHelperPath(binaryName: string) {return resolveUnpackedAppPath('electron', 'native', 'bin', getNativeArchTag(), binaryName)}+function resolvePreferredWindowsNativeHelperPath(helperDirectory: string, binaryName: string) {+ const buildOutputPath = resolveUnpackedAppPath(+ 'electron',+ 'native',+ helperDirectory,+ 'build',+ 'Release',+ binaryName,+ )+ const prebundledPath = getPrebundledNativeHelperPath(binaryName)++ if (existsSync(buildOutputPath)) {+ return buildOutputPath+ }++ if (existsSync(prebundledPath)) {+ return prebundledPath+ }++ return buildOutputPath+}+function getBundledWhisperExecutableCandidates() {const binaryNames = process.platform === 'win32'? ['whisper-cli.exe', 'whisper-cpp.exe', 'whisper.exe', 'main.exe']@@ -1666,11 +1688,11 @@ async function buildFfmpegCaptureArgs(source: SelectedSource, outputPath: string}function getWindowsCaptureExePath() {- return resolveUnpackedAppPath('electron', 'native', 'wgc-capture', 'build', 'Release', 'wgc-capture.exe')+ return resolvePreferredWindowsNativeHelperPath('wgc-capture', 'wgc-capture.exe')}function getCursorMonitorExePath() {- return resolveUnpackedAppPath('electron', 'native', 'cursor-monitor', 'build', 'Release', 'cursor-monitor.exe')+ return resolvePreferredWindowsNativeHelperPath('cursor-monitor', 'cursor-monitor.exe')}async function isNativeWindowsCaptureAvailable(): Promise<boolean> {diff --git a/electron/native/bin/win32-x64/cursor-monitor.exe b/electron/native/bin/win32-x64/cursor-monitor.exenew file mode 100644index 00000000..68f2e54fBinary files /dev/null and b/electron/native/bin/win32-x64/cursor-monitor.exe differdiff --git a/electron/native/bin/win32-x64/wgc-capture.exe b/electron/native/bin/win32-x64/wgc-capture.exenew file mode 100644index 00000000..c7b51cd5Binary files /dev/null and b/electron/native/bin/win32-x64/wgc-capture.exe differdiff --git a/scripts/build-cursor-monitor.mjs b/scripts/build-cursor-monitor.mjsindex 5b7409f1..e6393872 100644--- a/scripts/build-cursor-monitor.mjs+++ b/scripts/build-cursor-monitor.mjs@@ -1,10 +1,18 @@import { execSync } from "node:child_process";-import { existsSync, mkdirSync, rmSync } from "node:fs";+import { copyFileSync, existsSync, mkdirSync, rmSync } from "node:fs";import path from "node:path";const projectRoot = process.cwd();const sourceDir = path.join(projectRoot, "electron", "native", "cursor-monitor");const buildDir = path.join(sourceDir, "build");+const bundledDir = path.join(+ projectRoot,+ "electron",+ "native",+ "bin",+ process.arch === "arm64" ? "win32-arm64" : "win32-x64",+);+const bundledExePath = path.join(bundledDir, "cursor-monitor.exe");if (process.platform !== "win32") {console.log("[build-cursor-monitor] Skipping: host platform is not Windows.");@@ -70,6 +78,11 @@ function findCmake() {const cmake = findCmake();if (!cmake) {+ if (existsSync(bundledExePath)) {+ console.log(`[build-cursor-monitor] Using bundled helper: ${bundledExePath}`);+ process.exit(0);+ }+console.error("[build-cursor-monitor] CMake not found. Install Visual Studio with C++ CMake tools or standalone CMake.",);@@ -123,6 +136,9 @@ try {const exePath = path.join(buildDir, "Release", "cursor-monitor.exe");if (existsSync(exePath)) {console.log(`[build-cursor-monitor] Built successfully: ${exePath}`);+ mkdirSync(bundledDir, { recursive: true });+ copyFileSync(exePath, bundledExePath);+ console.log(`[build-cursor-monitor] Staged bundled helper: ${bundledExePath}`);} else {console.error("[build-cursor-monitor] Expected exe not found at", exePath);process.exit(1);diff --git a/scripts/build-windows-capture.mjs b/scripts/build-windows-capture.mjsindex 3cc3dcfc..86092806 100644--- a/scripts/build-windows-capture.mjs+++ b/scripts/build-windows-capture.mjs@@ -1,10 +1,18 @@-import { execSync } from 'node:child_process';-import { mkdirSync, existsSync, rmSync } from 'node:fs';-import path from 'node:path';+import { execSync } from "node:child_process";+import { copyFileSync, mkdirSync, existsSync, rmSync } from "node:fs";+import path from "node:path";const projectRoot = process.cwd();-const sourceDir = path.join(projectRoot, 'electron', 'native', 'wgc-capture');-const buildDir = path.join(sourceDir, 'build');+const sourceDir = path.join(projectRoot, "electron", "native", "wgc-capture");+const buildDir = path.join(sourceDir, "build");+const bundledDir = path.join(+ projectRoot,+ "electron",+ "native",+ "bin",+ process.arch === "arm64" ? "win32-arm64" : "win32-x64",+);+const bundledExePath = path.join(bundledDir, "wgc-capture.exe");if (process.platform !== 'win32') {console.log('[build-windows-capture] Skipping native Windows capture build: host platform is not Windows.');@@ -70,8 +78,15 @@ function findCmake() {const cmake = findCmake();if (!cmake) {- console.error('[build-windows-capture] CMake not found. Install Visual Studio with C++ CMake tools or standalone CMake.');- process.exit(1);+ if (existsSync(bundledExePath)) {+ console.log(`[build-windows-capture] Using bundled helper: ${bundledExePath}`);+ process.exit(0);+ }++ console.error(+ "[build-windows-capture] CMake not found. Install Visual Studio with C++ CMake tools or standalone CMake.",+ );+ process.exit(1);}mkdirSync(buildDir, { recursive: true });@@ -120,7 +135,10 @@ try {const exePath = path.join(buildDir, 'Release', 'wgc-capture.exe');if (existsSync(exePath)) {- console.log(`[build-windows-capture] Built successfully: ${exePath}`);+ console.log(`[build-windows-capture] Built successfully: ${exePath}`);+ mkdirSync(bundledDir, { recursive: true });+ copyFileSync(exePath, bundledExePath);+ console.log(`[build-windows-capture] Staged bundled helper: ${bundledExePath}`);} else {console.error('[build-windows-capture] Expected exe not found at', exePath);process.exit(1);diff --git a/src/index.css b/src/index.cssindex 80d8fc45..4a863e92 100644--- a/src/index.css+++ b/src/index.css@@ -69,6 +69,7 @@@apply bg-background text-foreground;-webkit-user-select: none;user-select: none;+ font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;}button,