From 52b4d46cb34034e151737b87cf9713e06f11d757 Mon Sep 17 00:00:00 2001 From: Ryan Kurtz Date: Tue, 23 Sep 2025 11:38:29 -0400 Subject: [PATCH] GP-0: Detecting VSCode in Windows system installer location (Closes #8514) --- .../vscode/VSCodeIntegrationOptionsPlugin.java | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) 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; }; } }