Skip to content

Commit c080a40

Browse files
authored
Fixes the virtual link type (#281)
1 parent 6abbfba commit c080a40

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

packages/berry-core/sources/VirtualFetcher.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,15 @@ export class VirtualFetcher implements Fetcher {
8686
throw new Error(`Conflicting virtual paths (current ${currentLink} != new ${target})`);
8787

8888
if (currentLink === undefined) {
89-
await xfs.symlinkPromise(`${target}/` as PortablePath, virtualPath);
89+
// We need to check whether the target is a directory because the
90+
// Windows symlinks are typed and we need to create the right one
91+
const stat = await xfs.statPromise(to);
92+
93+
if (stat.isDirectory()) {
94+
await xfs.symlinkPromise(`${target}/` as PortablePath, virtualPath);
95+
} else {
96+
await xfs.symlinkPromise(target, virtualPath);
97+
}
9098
}
9199
});
92100

0 commit comments

Comments
 (0)