Various fixes

This commit is contained in:
crschnick 2024-05-25 20:33:00 +00:00
parent 05c7028e1e
commit ad7b001f1a
5 changed files with 17 additions and 15 deletions

View file

@ -64,11 +64,11 @@ public interface ExternalEditorType extends PrefsChoiceValue {
@Override @Override
protected Optional<Path> determineInstallation() { protected Optional<Path> determineInstallation() {
var found = WindowsRegistry.local().readString(WindowsRegistry.HKEY_LOCAL_MACHINE, "SOFTWARE\\Notepad++", null); var found = WindowsRegistry.local().readValue(WindowsRegistry.HKEY_LOCAL_MACHINE, "SOFTWARE\\Notepad++", null);
// Check 32 bit install // Check 32 bit install
if (found.isEmpty()) { if (found.isEmpty()) {
found = WindowsRegistry.local().readString( found = WindowsRegistry.local().readValue(
WindowsRegistry.HKEY_LOCAL_MACHINE, "WOW6432Node\\SOFTWARE\\Notepad++", null); WindowsRegistry.HKEY_LOCAL_MACHINE, "WOW6432Node\\SOFTWARE\\Notepad++", null);
} }
return found.map(p -> p + "\\notepad++.exe").map(Path::of); return found.map(p -> p + "\\notepad++.exe").map(Path::of);

View file

@ -85,7 +85,7 @@ public interface TabbyTerminalType extends ExternalTerminalType {
@Override @Override
protected Optional<Path> determineInstallation() { protected Optional<Path> determineInstallation() {
var perUser = WindowsRegistry.local().readString( var perUser = WindowsRegistry.local().readValue(
WindowsRegistry.HKEY_CURRENT_USER, WindowsRegistry.HKEY_CURRENT_USER,
"SOFTWARE\\71445fac-d6ef-5436-9da7-5a323762d7f5", "SOFTWARE\\71445fac-d6ef-5436-9da7-5a323762d7f5",
"InstallLocation") "InstallLocation")
@ -95,7 +95,7 @@ public interface TabbyTerminalType extends ExternalTerminalType {
return perUser; return perUser;
} }
var systemWide = WindowsRegistry.local().readString( var systemWide = WindowsRegistry.local().readValue(
WindowsRegistry.HKEY_LOCAL_MACHINE, WindowsRegistry.HKEY_LOCAL_MACHINE,
"SOFTWARE\\71445fac-d6ef-5436-9da7-5a323762d7f5", "SOFTWARE\\71445fac-d6ef-5436-9da7-5a323762d7f5",
"InstallLocation") "InstallLocation")

View file

@ -52,7 +52,7 @@ public interface WezTerminalType extends ExternalTerminalType {
@Override @Override
protected Optional<Path> determineInstallation() { protected Optional<Path> determineInstallation() {
Optional<String> launcherDir; Optional<String> launcherDir;
launcherDir = WindowsRegistry.local().readString( launcherDir = WindowsRegistry.local().readValue(
WindowsRegistry.HKEY_LOCAL_MACHINE, WindowsRegistry.HKEY_LOCAL_MACHINE,
"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\{BCF6F0DA-5B9A-408D-8562-F680AE6E1EAF}_is1", "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\{BCF6F0DA-5B9A-408D-8562-F680AE6E1EAF}_is1",
"InstallLocation") "InstallLocation")

View file

@ -33,15 +33,15 @@ public abstract class WindowsRegistry {
public abstract boolean valueExists(int hkey, String key, String valueName) throws Exception; public abstract boolean valueExists(int hkey, String key, String valueName) throws Exception;
public abstract Optional<String> readString(int hkey, String key, String valueName) throws Exception; public abstract Optional<String> readValue(int hkey, String key, String valueName) throws Exception;
public Optional<String> readString(int hkey, String key) throws Exception { public Optional<String> readValue(int hkey, String key) throws Exception {
return readString(hkey, key, null); return readValue(hkey, key, null);
} }
public abstract Optional<String> findValuesRecursive(int hkey, String key, String valueName) throws Exception; public abstract Optional<String> findValuesRecursive(int hkey, String key, String valueName) throws Exception;
public abstract Optional<Key> findKeyForEqualMatchRecursive(int hkey, String key, String match) throws Exception; public abstract Optional<Key> findKeyForEqualValueMatchRecursive(int hkey, String key, String match) throws Exception;
public static class Local extends WindowsRegistry { public static class Local extends WindowsRegistry {
@ -73,7 +73,7 @@ public abstract class WindowsRegistry {
} }
@Override @Override
public Optional<String> readString(int hkey, String key, String valueName) { public Optional<String> readValue(int hkey, String key, String valueName) {
// This can fail even with errors in case the jna native library extraction or loading fails // This can fail even with errors in case the jna native library extraction or loading fails
try { try {
if (!Advapi32Util.registryValueExists( if (!Advapi32Util.registryValueExists(
@ -98,9 +98,9 @@ public abstract class WindowsRegistry {
} }
@Override @Override
public Optional<Key> findKeyForEqualMatchRecursive(int hkey, String key, String match) throws Exception { public Optional<Key> findKeyForEqualValueMatchRecursive(int hkey, String key, String match) throws Exception {
try (var sc = LocalShell.getShell().start()) { try (var sc = LocalShell.getShell().start()) {
return new Remote(sc).findKeyForEqualMatchRecursive(hkey, key, match); return new Remote(sc).findKeyForEqualValueMatchRecursive(hkey, key, match);
} }
} }
} }
@ -140,7 +140,7 @@ public abstract class WindowsRegistry {
} }
@Override @Override
public Optional<String> readString(int hkey, String key, String valueName) throws Exception { public Optional<String> readValue(int hkey, String key, String valueName) throws Exception {
var command = CommandBuilder.of() var command = CommandBuilder.of()
.add("reg", "query") .add("reg", "query")
.addQuoted(hkey(hkey) + "\\" + key) .addQuoted(hkey(hkey) + "\\" + key)
@ -189,7 +189,7 @@ public abstract class WindowsRegistry {
} }
@Override @Override
public Optional<Key> findKeyForEqualMatchRecursive(int hkey, String key, String match) throws Exception { public Optional<Key> findKeyForEqualValueMatchRecursive(int hkey, String key, String match) throws Exception {
var command = CommandBuilder.of() var command = CommandBuilder.of()
.add("reg", "query") .add("reg", "query")
.addQuoted(hkey(hkey) + "\\" + key) .addQuoted(hkey(hkey) + "\\" + key)

View file

@ -18,6 +18,8 @@ The conflict resolution has been improved
## Other ## Other
- You can now add simple RDP connections without a file - You can now add simple RDP connections without a file
- Fix VMware Player/Workstation not being detected on Windows. Now simply searching for connections should add these VMs automatically - Fix VMware Player/Workstation and MSYS2 not being detected on Windows. Now simply searching for connections should add them automatically if they are installed
- The file browser sidebar now only contains connections that can be opened in it, reducing the amount of connection shown - The file browser sidebar now only contains connections that can be opened in it, reducing the amount of connection shown
- Fix SSH command failing on macOS with homebrew openssh package installed
- Fix SSH connections not opening the correct shell environment on Windows when username contained spaces due to an OpenSSH bug
- Fix newly added connections not having the correct order - Fix newly added connections not having the correct order