648
}
649
650
>
async function doCopySymlink(source: string, target: string, payload: ICopyPayload): Promise<void> {
pfs.ts
651
>
652
>
// Figure out link target
653
>
let linkTarget = await fs.promises.readlink(source);
654
>
655
>
// Special case: the symlink points to a target that is
656
>
// actually within the path that is being copied. In that
657
>
// case we want the symlink to point to the target and
658
>
// not the source
659
>
if (isEqualOrParent(linkTarget, payload.root.source, !isLinux)) {
660
linkTarget = join(payload.root.target, linkTarget.substr(payload.root.source.length + 1));
661
}
663
>
// Create symlink
664
>
await fs.promises.symlink(linkTarget, target);
665
>
}
666
667
//#endregion