Check for 32bit notepad++ installation

This commit is contained in:
crschnick 2023-08-19 19:08:56 +00:00
parent abcf67099b
commit 1d55692d26
2 changed files with 10 additions and 6 deletions

View file

@ -43,10 +43,13 @@ public interface ExternalEditorType extends PrefsChoiceValue {
@Override
protected Optional<Path> determineInstallation() {
Optional<String> 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);
}
};

View file

@ -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 : "")));
}
}
}