From 1d55692d26b388fe877f5a7f9e6ed6cbd6718ecf Mon Sep 17 00:00:00 2001 From: crschnick Date: Sat, 19 Aug 2023 19:08:56 +0000 Subject: [PATCH] Check for 32bit notepad++ installation --- .../java/io/xpipe/app/prefs/ExternalEditorType.java | 11 +++++++---- .../java/io/xpipe/app/util/ApplicationHelper.java | 5 +++-- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/io/xpipe/app/prefs/ExternalEditorType.java b/app/src/main/java/io/xpipe/app/prefs/ExternalEditorType.java index b30fa5d0..94c5ad97 100644 --- a/app/src/main/java/io/xpipe/app/prefs/ExternalEditorType.java +++ b/app/src/main/java/io/xpipe/app/prefs/ExternalEditorType.java @@ -43,10 +43,13 @@ public interface ExternalEditorType extends PrefsChoiceValue { @Override protected Optional determineInstallation() { - Optional launcherDir; - launcherDir = WindowsRegistry.readString(WindowsRegistry.HKEY_LOCAL_MACHINE, "SOFTWARE\\Notepad++", null) - .map(p -> p + "\\notepad++.exe"); - return launcherDir.map(Path::of); + var found = WindowsRegistry.readString(WindowsRegistry.HKEY_LOCAL_MACHINE, "SOFTWARE\\Notepad++", null); + + // Check 32 bit install + if (found.isEmpty()) { + found = WindowsRegistry.readString(WindowsRegistry.HKEY_LOCAL_MACHINE, "WOW6432Node\\SOFTWARE\\Notepad++", null); + } + return found.map(p -> p + "\\notepad++.exe").map(Path::of); } }; diff --git a/app/src/main/java/io/xpipe/app/util/ApplicationHelper.java b/app/src/main/java/io/xpipe/app/util/ApplicationHelper.java index f12b72ea..9c2858c4 100644 --- a/app/src/main/java/io/xpipe/app/util/ApplicationHelper.java +++ b/app/src/main/java/io/xpipe/app/util/ApplicationHelper.java @@ -1,5 +1,6 @@ package io.xpipe.app.util; +import io.xpipe.app.issue.ErrorEvent; import io.xpipe.app.issue.TrackEvent; import io.xpipe.core.impl.LocalStore; import io.xpipe.core.process.ShellControl; @@ -41,8 +42,8 @@ public class ApplicationHelper { ShellControl processControl, String executable, String displayName, String connectionName) throws Exception { if (!isInPath(processControl, executable)) { - throw new IOException(displayName + " executable " + executable + " not found in PATH" - + (connectionName != null ? " on system " + connectionName : "")); + throw ErrorEvent.unreportable(new IOException(displayName + " executable " + executable + " not found in PATH" + + (connectionName != null ? " on system " + connectionName : ""))); } } }