Skip to content

Commit 22b2fb8

Browse files
committed
fix(nx-plugin): fix Windows path handling in materializeTree
- Fix path.join issue with absolute paths starting with '/' - This resolves nx workspace root detection issues on Windows
1 parent 8a4a584 commit 22b2fb8

File tree

1 file changed

+5
-1
lines changed
  • testing/test-nx-utils/src/lib/utils

1 file changed

+5
-1
lines changed

testing/test-nx-utils/src/lib/utils/tree.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@ export async function materializeTree(tree: Tree, targetFolder: string) {
77
const changes = tree.listChanges();
88
await Promise.all(
99
changes.map(async change => {
10-
const filePath = path.join(targetFolder, change.path);
10+
// Handle absolute paths that start with '/' by making them relative
11+
const relativePath = change.path.startsWith('/')
12+
? change.path.slice(1)
13+
: change.path;
14+
const filePath = path.join(targetFolder, relativePath);
1115

1216
if (change.type === 'CREATE' || change.type === 'UPDATE') {
1317
try {

0 commit comments

Comments
 (0)