fix: address maintainer platform regressions

This commit is contained in:
EtienneLescot
2026-05-06 14:17:45 +02:00
parent f4fc7fab9e
commit 722f630117
7 changed files with 189 additions and 44 deletions
+9
View File
@@ -453,6 +453,14 @@ function resolveUnpackedAppPath(...segments: string[]) {
return resolved;
}
function resolvePackagedResourcePath(...segments: string[]) {
if (!app.isPackaged) {
return null;
}
return path.join(process.resourcesPath, ...segments);
}
function getNativeWindowsCaptureHelperCandidates() {
const envPath = process.env.OPENSCREEN_WGC_CAPTURE_EXE?.trim();
const archTag = process.arch === "arm64" ? "win32-arm64" : "win32-x64";
@@ -468,6 +476,7 @@ function getNativeWindowsCaptureHelperCandidates() {
),
resolveUnpackedAppPath("electron", "native", "wgc-capture", "build", "wgc-capture.exe"),
resolveUnpackedAppPath("electron", "native", "bin", archTag, "wgc-capture.exe"),
resolvePackagedResourcePath("electron", "native", "bin", archTag, "wgc-capture.exe"),
].filter((candidate): candidate is string => Boolean(candidate));
}
@@ -1,6 +1,6 @@
import type { Rectangle } from "electron";
import type { CursorRecordingData } from "../../../../src/native/contracts";
import type { CursorRecordingSession } from "./session";
import { TelemetryRecordingSession } from "./telemetryRecordingSession";
import { WindowsNativeRecordingSession } from "./windowsNativeRecordingSession";
interface CreateCursorRecordingSessionOptions {
@@ -12,6 +12,21 @@ interface CreateCursorRecordingSessionOptions {
startTimeMs?: number;
}
class NoopCursorRecordingSession implements CursorRecordingSession {
async start(): Promise<void> {
// Native cursor capture is currently Windows-only.
}
async stop(): Promise<CursorRecordingData> {
return {
version: 2,
provider: "none",
assets: [],
samples: [],
};
}
}
export function createCursorRecordingSession(
options: CreateCursorRecordingSessionOptions,
): CursorRecordingSession {
@@ -25,10 +40,5 @@ export function createCursorRecordingSession(
});
}
return new TelemetryRecordingSession({
getDisplayBounds: options.getDisplayBounds,
maxSamples: options.maxSamples,
sampleIntervalMs: options.sampleIntervalMs,
startTimeMs: options.startTimeMs,
});
return new NoopCursorRecordingSession();
}