-
Notifications
You must be signed in to change notification settings - Fork 15
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
base: main
Are you sure you want to change the base?
Fix path search #135
Conversation
7cc1632
to
d411df7
Compare
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: |
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 | ||
} | ||
} |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
…winget-dsc into fix-vscode-search-path
Addresses issue #105
Microsoft Reviewers: Open in CodeFlow