mirror of
https://github.com/arduino/Arduino.git
synced 2024-12-01 12:24:14 +01:00
Re-introducing JNA, used only on Windows and only to access Windows Registry. Should fix #3360
This commit is contained in:
parent
7d8d07889f
commit
98eb1a9ee2
BIN
arduino-core/lib/jna-4.1.0.jar
Normal file
BIN
arduino-core/lib/jna-4.1.0.jar
Normal file
Binary file not shown.
BIN
arduino-core/lib/jna-platform-4.1.0.jar
Normal file
BIN
arduino-core/lib/jna-platform-4.1.0.jar
Normal file
Binary file not shown.
@ -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.
|
||||
*/
|
||||
|
@ -28,6 +28,8 @@
|
||||
<cp>lib/jackson-module-mrbean-2.2.3.jar</cp>
|
||||
<cp>lib/java-semver-0.8.0.jar</cp>
|
||||
<cp>lib/jmdns-3.4.1.jar</cp>
|
||||
<cp>lib/jna-4.1.0.jar</cp>
|
||||
<cp>lib/jna-platform-4.1.0.jar</cp>
|
||||
<cp>lib/jsch-0.1.50.jar</cp>
|
||||
<cp>lib/jssc-2.8.0.jar</cp>
|
||||
<cp>lib/pde.jar</cp>
|
||||
|
@ -28,6 +28,8 @@
|
||||
<cp>lib/jackson-module-mrbean-2.2.3.jar</cp>
|
||||
<cp>lib/java-semver-0.8.0.jar</cp>
|
||||
<cp>lib/jmdns-3.4.1.jar</cp>
|
||||
<cp>lib/jna-4.1.0.jar</cp>
|
||||
<cp>lib/jna-platform-4.1.0.jar</cp>
|
||||
<cp>lib/jsch-0.1.50.jar</cp>
|
||||
<cp>lib/jssc-2.8.0.jar</cp>
|
||||
<cp>lib/pde.jar</cp>
|
||||
|
Loading…
Reference in New Issue
Block a user