Skip to content

Commit

Permalink
Replace symlink resolution with realpath
Browse files Browse the repository at this point in the history
  • Loading branch information
arunchndr committed Aug 25, 2023
1 parent 002c58d commit e6a2db3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
- Debug from .csproj and .sln [#5876](https://github.com/dotnet/vscode-csharp/issues/5876)

## Latest
* Fix URIFormatException during dotnet SDK resolution when symlinks are involved (PR: [#6230](https://github.com/dotnet/vscode-csharp/pull/6230))

## 2.0.413
* Update Roslyn (PR: [#6131](https://github.com/dotnet/vscode-csharp/pull/6131))
* Only show toast for project load failures (PR: [#69494](https://github.com/dotnet/roslyn/pull/69494))
* Fix enter inserting /// on the incorrect line in documentation comments (PR: [#6130](https://github.com/dotnet/vscode-csharp/pull/6130))
Expand Down
10 changes: 2 additions & 8 deletions src/lsptoolshost/dotnetRuntimeExtensionResolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { CSharpExtensionId } from '../constants/csharpExtensionId';
import { promisify } from 'util';
import { exec } from 'child_process';
import { getDotnetInfo } from '../shared/utils/getDotnetInfo';
import { readFile, readlink } from 'fs/promises';
import { readFile, realpath } from 'fs/promises';

export const DotNetRuntimeVersion = '7.0';

Expand Down Expand Up @@ -183,13 +183,7 @@ export class DotnetRuntimeExtensionResolver implements IHostExecutableResolver {

// If dotnet is just a symlink, resolve it to the actual executable so
// callers will be able to get the actual directory containing the exe.
try {
const targetPath = await readlink(path);
return targetPath;
} catch {
// Not a symlink.
return path;
}
return await realpath(path);
} catch (e) {
this.channel.appendLine(
'Failed to find dotnet info from path, falling back to acquire runtime via ms-dotnettools.vscode-dotnet-runtime'
Expand Down

0 comments on commit e6a2db3

Please sign in to comment.