@@ -12,6 +12,7 @@ import { RushConfiguration } from '../../api/RushConfiguration';
1212import { Utilities } from '../../utilities/Utilities' ;
1313import { Stopwatch } from '../../utilities/Stopwatch' ;
1414import { BasePackage } from './BasePackage' ;
15+ import { EnvironmentConfiguration } from '../../api/EnvironmentConfiguration' ;
1516
1617export enum SymlinkKind {
1718 File ,
@@ -29,15 +30,22 @@ export abstract class BaseLinkManager {
2930 const newLinkFolder : string = path . dirname ( options . newLinkPath ) ;
3031 FileSystem . ensureFolder ( newLinkFolder ) ;
3132
32- // Link to the relative path, to avoid going outside containers such as a Docker image
33- const targetRelativePath : string = path . relative ( fs . realpathSync ( newLinkFolder ) ,
34- options . linkTargetPath ) ;
33+ let targetPath : string ;
34+ if ( EnvironmentConfiguration . absoluteSymlinks ) {
35+ targetPath = options . linkTargetPath ;
36+ } else {
37+ // Link to the relative path, to avoid going outside containers such as a Docker image
38+ targetPath = path . relative (
39+ fs . realpathSync ( newLinkFolder ) ,
40+ options . linkTargetPath
41+ ) ;
42+ }
3543
3644 if ( process . platform === 'win32' ) {
3745 if ( options . symlinkKind === SymlinkKind . Directory ) {
3846 // For directories, we use a Windows "junction". On Unix, this produces a regular symlink.
3947 FileSystem . createSymbolicLinkJunction ( {
40- linkTargetPath : targetRelativePath ,
48+ linkTargetPath : targetPath ,
4149 newLinkPath : options . newLinkPath
4250 } ) ;
4351 } else {
@@ -55,12 +63,12 @@ export abstract class BaseLinkManager {
5563 // we use symbolic links for this case.
5664 if ( options . symlinkKind === SymlinkKind . Directory ) {
5765 FileSystem . createSymbolicLinkFolder ( {
58- linkTargetPath : targetRelativePath ,
66+ linkTargetPath : targetPath ,
5967 newLinkPath : options . newLinkPath
6068 } ) ;
6169 } else {
6270 FileSystem . createSymbolicLinkFile ( {
63- linkTargetPath : targetRelativePath ,
71+ linkTargetPath : targetPath ,
6472 newLinkPath : options . newLinkPath
6573 } ) ;
6674 }
0 commit comments