Files
Recordly/electron/ipc/project/canonicalSourceReference.ts
T
webadderall f007984ebc Fix editor previews, zoom controls and recording workflow
Preserve renderer state through mute and export transitions, gate hover previews on a composed frame, and align timeline bounds with authored zoom intervals. Improve settings, cursor and webcam controls, inline recording countdown, project recovery and safe library cleanup.
2026-11-06 18:05:14 +11:00

21 lines
668 B
TypeScript

import fs from "node:fs/promises";
import path from "node:path";
/** Preserve the capture family even when its main file is missing through a folder alias. */
export async function canonicalSourceReference(source: string): Promise<string> {
let current = path.resolve(source);
const missing: string[] = [];
for (;;) {
try {
return path.join(await fs.realpath(current), ...missing);
} catch (error) {
if (!["ENOENT", "ENOTDIR"].includes((error as NodeJS.ErrnoException).code ?? ""))
throw error;
const parent = path.dirname(current);
if (parent === current) throw error;
missing.unshift(path.basename(current));
current = parent;
}
}
}