|
25 | 25 | } |
26 | 26 | }, |
27 | 27 | "env_add_path": "bin", |
28 | | - "shortcuts": [ |
29 | | - [ |
30 | | - "code.exe", |
31 | | - "Visual Studio Code" |
32 | | - ] |
33 | | - ], |
| 28 | + "shortcuts": [["code.exe", "Visual Studio Code"]], |
34 | 29 | "post_install": [ |
35 | 30 | "$dirpath = \"$dir\".Replace('\\', '\\\\')", |
36 | 31 | "$exepath = \"$dir\\Code.exe\".Replace('\\', '\\\\')", |
| 32 | + "$hash = (Get-ChildItem $dir -Directory | Where-Object Name -match '^[a-z0-9]{10,}$' | Select-Object -First 1).Name", |
| 33 | + "if ($hash) { $hashPath = \"$dir\\$hash\".Replace('\\', '\\\\') } else { $hashPath = $dirpath }", |
37 | 34 | "'install-associations', 'uninstall-associations', 'install-context', 'uninstall-context', 'install-github-integration', 'uninstall-github-integration' | ForEach-Object {", |
38 | 35 | " if (Test-Path \"$bucketsdir\\extras\\scripts\\vscode\\$_.reg\") {", |
39 | 36 | " $content = Get-Content \"$bucketsdir\\extras\\scripts\\vscode\\$_.reg\"", |
40 | | - " $content = $content.Replace('$codedir', $dirpath)", |
| 37 | + " if ($_ -match 'github') {", |
| 38 | + " $targetDir = $dirpath", |
| 39 | + " } else {", |
| 40 | + " $targetDir = $hashPath", |
| 41 | + " }", |
| 42 | + " $content = $content.Replace('$codedir', $targetDir)", |
41 | 43 | " $content = $content.Replace('$code', $exepath)", |
42 | 44 | " if ($global) {", |
43 | 45 | " $content = $content.Replace('HKEY_CURRENT_USER', 'HKEY_LOCAL_MACHINE')", |
|
63 | 65 | "script": [ |
64 | 66 | "if ($cmd -eq 'uninstall')", |
65 | 67 | "{", |
| 68 | + " reg import \"$dir\\uninstall-associations.reg\" ", |
66 | 69 | " reg import \"$dir\\uninstall-context.reg\" ", |
67 | 70 | " reg import \"$dir\\uninstall-github-integration.reg\" ", |
68 | 71 | "}" |
|
0 commit comments