Skip to content

Conversation

@YuliiaKovalova
Copy link
Contributor

Revert code style changes + undo all extra changes in DotNetSdkLocationHelper

&& Path.GetFileName(dotnetExePath).Equals(ExeName, StringComparison.InvariantCultureIgnoreCase);

if (isRunFromDotnetExecutable)
{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We still lost some fixes here, the issue is DOTNET_HOST_PATH points to the dotnet executable, so it cannot be done the same way as other environment variables pointing to a directory.

in the code lost in the last Style PR, the code looks like this ( I guess it needs to be integrated back as the logic is now different. Basically, it needs to handle symbol link, and then get the directory containing the file

                // DOTNET_HOST_PATH is pointing to the file, DOTNET_ROOT is the path of the folder
                string? hostPath = Environment.GetEnvironmentVariable("DOTNET_HOST_PATH");
                if (!string.IsNullOrEmpty(hostPath) && File.Exists(hostPath))
                {
                    if (!IsWindows)
                    {
                        hostPath = realpath(hostPath) ?? hostPath;
                    }

                    dotnetPath = Path.GetDirectoryName(hostPath);
                    if (dotnetPath is not null)
                    {
                        // don't overwrite DOTNET_HOST_PATH, if we use it.
                        return dotnetPath;
                    }
                }

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@YuliiaKovalova YuliiaKovalova merged commit 8ff2415 into microsoft:master Sep 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants