Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix path search #135

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open

Conversation

Gijsreyn
Copy link
Contributor

@Gijsreyn Gijsreyn commented Dec 6, 2024


Addresses issue #105

Microsoft Reviewers: Open in CodeFlow

@Gijsreyn Gijsreyn force-pushed the fix-vscode-search-path branch from 7cc1632 to d411df7 Compare December 11, 2024 01:12
@microsoft-github-policy-service microsoft-github-policy-service bot removed Changes-Requested Changes Requested Needs-Author-Feedback This needs a response from the author. labels Dec 11, 2024
@Gijsreyn
Copy link
Contributor Author

Gijsreyn commented Dec 11, 2024

Thanks for the comments @ryfu-msft . I have rewritten the logic and grabbed most of the old stuff from you. Looking at the code from: https://github.com/desktop/desktop/blob/development/app/src/lib/editors/win32.ts, I included the WOW6432Node path as well. Let me know what you think.

On a 64-bit system, I'm getting this:

image

resources/Microsoft.VSCode.Dsc/Microsoft.VSCode.Dsc.psm1 Outdated Show resolved Hide resolved
resources/Microsoft.VSCode.Dsc/Microsoft.VSCode.Dsc.psm1 Outdated Show resolved Hide resolved
resources/Microsoft.VSCode.Dsc/Microsoft.VSCode.Dsc.psm1 Outdated Show resolved Hide resolved
Comment on lines +70 to +78
foreach ($hive in $registryHive) {
foreach ($key in $registryKeys) {
Write-Verbose -Message ("Searching path '{0}' with key '{1}'" -f $hive, $key)
$installLocation = TryGetRegistryValue -Key "$hive\$key" -Property 'InstallLocation'
if ($installLocation) {
$cmdPath = $Insiders ? 'bin\code-insiders.cmd' : 'bin\code.cmd'
return Join-Path $installLocation $cmdPath
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not a fan of iterating through registry key entries until we find a match. Based on the parameters provided (scope, isInsiders) for the DSC resource, it should be deterministic as to where the VSCode should be installed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nor am I buddy. The thing is, DSC doesn't know the scope; WinGet does. We don't have a property for it. It is only 3 locations it iterates through, and if it finds one, it returns it. What do you think? Can we push this through, or do you have another suggestion for it?

@microsoft-github-policy-service microsoft-github-policy-service bot added Changes-Requested Changes Requested Needs-Author-Feedback This needs a response from the author. labels Dec 20, 2024
@microsoft-github-policy-service microsoft-github-policy-service bot removed Changes-Requested Changes Requested Needs-Author-Feedback This needs a response from the author. labels Dec 21, 2024
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.

2 participants