From 74d2ae10231fa26dbaaba9036f681493e9be1a61 Mon Sep 17 00:00:00 2001 From: YeonGyu-Kim Date: Sat, 14 Feb 2026 22:06:13 +0900 Subject: [PATCH] fix(shared): normalize macOS realpath output --- src/shared/file-utils.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/shared/file-utils.ts b/src/shared/file-utils.ts index 47d6c9f6..b6edfdce 100644 --- a/src/shared/file-utils.ts +++ b/src/shared/file-utils.ts @@ -1,6 +1,10 @@ import { lstatSync, realpathSync } from "fs" import { promises as fs } from "fs" +function normalizeDarwinRealpath(filePath: string): string { + return filePath.startsWith("/private/var/") ? filePath.slice("/private".length) : filePath +} + export function isMarkdownFile(entry: { name: string; isFile: () => boolean }): boolean { return !entry.name.startsWith(".") && entry.name.endsWith(".md") && entry.isFile() } @@ -15,7 +19,7 @@ export function isSymbolicLink(filePath: string): boolean { export function resolveSymlink(filePath: string): string { try { - return realpathSync(filePath) + return normalizeDarwinRealpath(realpathSync(filePath)) } catch { return filePath } @@ -23,7 +27,7 @@ export function resolveSymlink(filePath: string): string { export async function resolveSymlinkAsync(filePath: string): Promise { try { - return await fs.realpath(filePath) + return normalizeDarwinRealpath(await fs.realpath(filePath)) } catch { return filePath }