File tree Expand file tree Collapse file tree 1 file changed +4
-26
lines changed
src/Resolvers/Microsoft.DotNet.NativeWrapper Expand file tree Collapse file tree 1 file changed +4
-26
lines changed Original file line number Diff line number Diff line change @@ -75,34 +75,12 @@ private IEnumerable<string> SearchPaths
7575 {
7676 // e.g. on Linux the 'dotnet' command from PATH is a symlink so we need to
7777 // resolve it to get the actual path to the binary
78- dotnetExeFromPath = GetRealPath ( dotnetExeFromPath ) ;
79-
80- static string GetRealPath ( string path )
78+ FileSystemInfo fileInfo = new FileInfo ( dotnetExeFromPath ) ;
79+ if ( ( fileInfo . Attributes & FileAttributes . ReparsePoint ) != 0 )
8180 {
82- FileInfo fileInfo = new ( path ) ;
83- if ( fileInfo . LinkTarget != null )
84- {
85- var resolved = fileInfo . ResolveLinkTarget ( true ) ;
86- return resolved ? . Exists is true ? resolved . FullName : path ;
87- }
88-
89- string invariantPart = string . Empty ;
90- DirectoryInfo ? parentDirectory = fileInfo . Directory ;
91- while ( parentDirectory is not null )
92- {
93- invariantPart = path [ parentDirectory . FullName . Length ..] ;
94- if ( parentDirectory . LinkTarget != null )
95- {
96- var resolved = parentDirectory . ResolveLinkTarget ( true ) ;
97- if ( resolved ? . Exists is true )
98- return Path . Join ( resolved . FullName , invariantPart ) ;
99- }
100-
101- parentDirectory = parentDirectory . Parent ;
102- }
103-
104- return path ;
81+ fileInfo = fileInfo . ResolveLinkTarget ( returnFinalTarget : true ) ?? fileInfo ;
10582 }
83+ dotnetExeFromPath = fileInfo . FullName ;
10684 }
10785#endif
10886
You can’t perform that action at this time.
0 commit comments