INNER CODE UNIT · TypeScript

noteExistingPathDeltaSupport

totec448-spec/chat-on-steroids · src/main/codex/apply-patch/index.ts:425

async function noteExistingPathDeltaSupport(path: string, delta: AppliedPatchDelta): Promise<void> {
  try {
    const metadata = await getMetadata(path);
    if (!(metadata.isFile && !metadata.isSymlink)) delta.exact = false;
  } catch (error) {
    if (errorCode(error) !== 'ENOENT') delta.exact = false;
  }
}

async function writeFileWithMissingParentRetry(path: string, contents: string): Promise<void> {
  try {
    await writeFile(path, contents);
    return;
  } catch (error) {
    if (errorCode(error) !== 'ENOENT') {
      throw new Error(`Failed to write file ${path}`, { cause: error });
    }
  }

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…