Skip to content

Ghidra is a software reverse engineering (SRE) framework

GP-0: Detecting VSCode in Windows system installer location (Closes #8514)

Ryan Kurtz52b4d46cb340
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/vscode/VSCodeIntegrationOptionsPlugin.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/vscode/VSCodeIntegrationOptionsPlugin.java
index 749be4ba4d..e32e0675a0 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/vscode/VSCodeIntegrationOptionsPlugin.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/vscode/VSCodeIntegrationOptionsPlugin.java
@@ -66,12 +66,18 @@ public class VSCodeIntegrationOptionsPlugin extends Plugin implements Applicatio
*/
private static File getDefaultVSCodeExecutable() {
return switch (OperatingSystem.CURRENT_OPERATING_SYSTEM) {
- case WINDOWS -> new File(System.getenv("LOCALAPPDATA"),
- "Programs/Microsoft VS Code/bin/code.cmd");
- case MAC_OS_X -> new File(
- "/Applications/Visual Studio Code.app/Contents/MacOS/Electron");
- case LINUX -> new File("/usr/bin/code");
- default -> null;
+ case WINDOWS:
+ File local = new File(System.getenv("LOCALAPPDATA"),
+ "Programs/Microsoft VS Code/bin/code.cmd");
+ File admin =
+ new File(System.getenv("PROGRAMFILES"), "Microsoft VS Code/bin/code.cmd");
+ yield admin.exists() ? admin : local;
+ case MAC_OS_X:
+ yield new File("/Applications/Visual Studio Code.app/Contents/MacOS/Electron");
+ case LINUX:
+ yield new File("/usr/bin/code");
+ default:
+ yield null;
};
}
}