From 4ca55663ee7be1de2d7f04417685df81dd3a690e Mon Sep 17 00:00:00 2001 From: Detlev Detleffsen Date: Tue, 2 Jun 2026 18:19:30 +0200 Subject: [PATCH] fix(core): support Windows symlinks via junction/copy fallback On Windows, fs.symlink() fails without elevated privileges. Use junctions for directories and copyFile for files instead. Unix behavior remains unchanged (plain symlink). --- packages/core/src/paths/symlinks.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/packages/core/src/paths/symlinks.ts b/packages/core/src/paths/symlinks.ts index 95b14fc..2d372f9 100644 --- a/packages/core/src/paths/symlinks.ts +++ b/packages/core/src/paths/symlinks.ts @@ -44,7 +44,16 @@ export async function createSymlinks( // ignore — entry doesn't exist yet } - await fs.symlink(entryAbsPath, symlinkPath); + const entryStat = await fs.stat(entryAbsPath); + if (process.platform === "win32") { + if (entryStat.isDirectory()) { + await fs.symlink(entryAbsPath, symlinkPath, "junction"); + } else { + await fs.copyFile(entryAbsPath, symlinkPath); + } + } else { + await fs.symlink(entryAbsPath, symlinkPath); + } } } } catch (error) { @@ -104,3 +113,4 @@ export async function removeSymlinks(targetDir: string): Promise { } } } +