diff --git a/arduino-core/lib/jna-4.1.0.jar b/arduino-core/lib/jna-4.1.0.jar
new file mode 100644
index 000000000..b1a3922fe
Binary files /dev/null and b/arduino-core/lib/jna-4.1.0.jar differ
diff --git a/arduino-core/lib/jna-platform-4.1.0.jar b/arduino-core/lib/jna-platform-4.1.0.jar
new file mode 100644
index 000000000..8d5fe3dee
Binary files /dev/null and b/arduino-core/lib/jna-platform-4.1.0.jar differ
diff --git a/arduino-core/src/processing/app/windows/Platform.java b/arduino-core/src/processing/app/windows/Platform.java
index d784bef37..15647dd0e 100644
--- a/arduino-core/src/processing/app/windows/Platform.java
+++ b/arduino-core/src/processing/app/windows/Platform.java
@@ -22,6 +22,8 @@
package processing.app.windows;
+import com.sun.jna.platform.win32.Advapi32Util;
+import com.sun.jna.platform.win32.WinReg;
import org.apache.commons.exec.CommandLine;
import org.apache.commons.exec.DefaultExecutor;
import org.apache.commons.exec.Executor;
@@ -52,25 +54,15 @@ public class Platform extends processing.app.Platform {
}
private void recoverSettingsFolderPath() throws IOException {
- String path = getFolderPathFromRegistry("AppData");
+ String path = Advapi32Util.registryGetStringValue(WinReg.HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders", "AppData");
this.settingsFolder = new File(path, "Arduino15");
}
private void recoverDefaultSketchbookFolder() throws IOException {
- String path = getFolderPathFromRegistry("Personal");
+ String path = Advapi32Util.registryGetStringValue(WinReg.HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders", "Personal");
this.defaultSketchbookFolder = new File(path, "Arduino");
}
- private String getFolderPathFromRegistry(String folderType) throws IOException {
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- Executor executor = new DefaultExecutor();
- executor.setStreamHandler(new PumpStreamHandler(baos, null));
-
- CommandLine toDevicePath = CommandLine.parse("reg query \"HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders\" /v \"" + folderType + "\"");
- executor.execute(toDevicePath);
- return new RegQueryParser(new String(baos.toByteArray())).getValueOfKey();
- }
-
/**
* Remove extra quotes, slashes, and garbage from the Windows PATH.
*/
diff --git a/build/windows/launcher/config.xml b/build/windows/launcher/config.xml
index 1df6d0e0b..e1822cdc2 100644
--- a/build/windows/launcher/config.xml
+++ b/build/windows/launcher/config.xml
@@ -28,6 +28,8 @@
lib/jackson-module-mrbean-2.2.3.jar
lib/java-semver-0.8.0.jar
lib/jmdns-3.4.1.jar
+ lib/jna-4.1.0.jar
+ lib/jna-platform-4.1.0.jar
lib/jsch-0.1.50.jar
lib/jssc-2.8.0.jar
lib/pde.jar
diff --git a/build/windows/launcher/config_debug.xml b/build/windows/launcher/config_debug.xml
index 69ff6c472..83fed70a9 100644
--- a/build/windows/launcher/config_debug.xml
+++ b/build/windows/launcher/config_debug.xml
@@ -28,6 +28,8 @@
lib/jackson-module-mrbean-2.2.3.jar
lib/java-semver-0.8.0.jar
lib/jmdns-3.4.1.jar
+ lib/jna-4.1.0.jar
+ lib/jna-platform-4.1.0.jar
lib/jsch-0.1.50.jar
lib/jssc-2.8.0.jar
lib/pde.jar