Skip to content

Commit bcd7e57

Browse files
author
Timabliss
committed
fix(vscode): inject dynamic hash path for file association icons
- Detects the version hash directory (e.g. 591199df...) in post_install. - Uses hash path for 'associations' registry templates to fix missing icons. - Keeps standard path for 'github-integration' and 'context' to avoid breaking git tools. - Add 'uninstall-associations.reg' to the uninstaller script
1 parent 780bc78 commit bcd7e57

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

bucket/vscode.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,13 @@
3434
"post_install": [
3535
"$dirpath = \"$dir\".Replace('\\', '\\\\')",
3636
"$exepath = \"$dir\\Code.exe\".Replace('\\', '\\\\')",
37+
"$hash = (Get-ChildItem $dir -Directory | Where-Object Name -match '^[a-z0-9]{10,}$' | Select-Object -First 1).Name",
38+
"if ($hash) { $hashPath = \"$dir\\$hash\".Replace('\\', '\\\\') } else { $hashPath = $dirpath }",
3739
"'install-associations', 'uninstall-associations', 'install-context', 'uninstall-context', 'install-github-integration', 'uninstall-github-integration' | ForEach-Object {",
3840
" if (Test-Path \"$bucketsdir\\extras\\scripts\\vscode\\$_.reg\") {",
3941
" $content = Get-Content \"$bucketsdir\\extras\\scripts\\vscode\\$_.reg\"",
40-
" $content = $content.Replace('$codedir', $dirpath)",
42+
" if ($_ -match 'github') {$targetDir = $dirpath,} else {$targetDir = $hashPath}",
43+
" $content = $content.Replace('$codedir', $targetDir)",
4144
" $content = $content.Replace('$code', $exepath)",
4245
" if ($global) {",
4346
" $content = $content.Replace('HKEY_CURRENT_USER', 'HKEY_LOCAL_MACHINE')",
@@ -63,6 +66,7 @@
6366
"script": [
6467
"if ($cmd -eq 'uninstall')",
6568
"{",
69+
" reg import \"$dir\\uninstall-associations.reg\" ",
6670
" reg import \"$dir\\uninstall-context.reg\" ",
6771
" reg import \"$dir\\uninstall-github-integration.reg\" ",
6872
"}"

0 commit comments

Comments
 (0)