Skip to content

Commit f6546ae

Browse files
author
Federico Fissore
committed
Windows: got rid on JNA, thus no more UnsatisfiedLinkError (at least when accessing native OS functions). Fixes #3190
1 parent 0262105 commit f6546ae

31 files changed

+109
-1199
lines changed

.classpath

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
<classpathentry kind="lib" path="app/lib/antlr.jar"/>
77
<classpathentry kind="lib" path="app/lib/apple.jar"/>
88
<classpathentry kind="lib" path="app/lib/ecj.jar"/>
9-
<classpathentry kind="lib" path="app/lib/jna.jar"/>
109
<classpathentry kind="lib" path="app/test-lib/junit-4.11.jar"/>
1110
<classpathentry kind="lib" path="app/test-lib/fest-assert-1.2.jar"/>
1211
<classpathentry kind="lib" path="app/test-lib/fest-reflect-1.2.jar"/>

app/.classpath

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
<classpathentry kind="src" path="test"/>
55
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
66
<classpathentry kind="lib" path="lib/antlr.jar"/>
7-
<classpathentry kind="lib" path="lib/jna.jar"/>
87
<classpathentry kind="lib" path="lib/ecj.jar"/>
98
<classpathentry kind="lib" path="lib/apple.jar"/>
109
<classpathentry kind="lib" path="lib/bcpg-jdk15on-152.jar"/>

app/.classpath_macosx

-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
<classpathentry combineaccessrules="false" kind="src" path="/serial"/>
1515
<classpathentry combineaccessrules="false" kind="src" path="/video"/>
1616
<classpathentry kind="lib" path="lib/antlr.jar"/>
17-
<classpathentry kind="lib" path="lib/jna.jar"/>
1817
<classpathentry kind="lib" path="lib/ecj.jar"/>
1918
<classpathentry kind="output" path="bin"/>
2019
</classpath>

app/.classpath_vista

-21
This file was deleted.

app/lib/jna.LICENSE.LGPL-2.1.txt

-1
This file was deleted.

app/lib/jna.jar

-611 KB
Binary file not shown.

app/run-linux.launch

-22
This file was deleted.

app/src/cc/arduino/view/preferences/Preferences.form

-7
Original file line numberDiff line numberDiff line change
@@ -617,13 +617,6 @@
617617
</Property>
618618
</Properties>
619619
</Component>
620-
<Component class="javax.swing.JCheckBox" name="autoAssociateBox">
621-
<Properties>
622-
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
623-
<Connection code="_(&quot;Automatically associate .ino files with Arduino&quot;)" type="code"/>
624-
</Property>
625-
</Properties>
626-
</Component>
627620
<Component class="javax.swing.JCheckBox" name="saveVerifyUploadBox">
628621
<Properties>
629622
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">

app/src/cc/arduino/view/preferences/Preferences.java

-19
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
import processing.app.I18n;
3535
import processing.app.PreferencesData;
3636
import processing.app.helpers.FileUtils;
37-
import processing.app.helpers.OSUtils;
3837
import processing.app.legacy.PApplet;
3938

4039
import javax.swing.*;
@@ -198,11 +197,6 @@ public void actionPerformed(ActionEvent e) {
198197
}
199198
});
200199

201-
if (!OSUtils.isWindows() || base.getPortableFolder() != null) {
202-
autoAssociateBox.setEnabled(false);
203-
autoAssociateBox.getParent().remove(autoAssociateBox);
204-
}
205-
206200
showPrerefencesData();
207201
}
208202

@@ -256,7 +250,6 @@ private void initComponents() {
256250
externalEditorBox = new javax.swing.JCheckBox();
257251
checkUpdatesBox = new javax.swing.JCheckBox();
258252
updateExtensionBox = new javax.swing.JCheckBox();
259-
autoAssociateBox = new javax.swing.JCheckBox();
260253
saveVerifyUploadBox = new javax.swing.JCheckBox();
261254

262255
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
@@ -445,9 +438,6 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
445438
updateExtensionBox.setText(_("Update sketch files to new extension on save (.pde -> .ino)"));
446439
checkboxesContainer.add(updateExtensionBox);
447440

448-
autoAssociateBox.setText(_("Automatically associate .ino files with Arduino"));
449-
checkboxesContainer.add(autoAssociateBox);
450-
451441
saveVerifyUploadBox.setText(_("Save when verifying or uploading"));
452442
checkboxesContainer.add(saveVerifyUploadBox);
453443

@@ -610,7 +600,6 @@ private void okButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRS
610600

611601
// Variables declaration - do not modify//GEN-BEGIN:variables
612602
private javax.swing.JTextField additionalBoardsManagerField;
613-
private javax.swing.JCheckBox autoAssociateBox;
614603
private javax.swing.JCheckBox checkUpdatesBox;
615604
private javax.swing.JComboBox comboLanguage;
616605
private javax.swing.JComboBox comboWarnings;
@@ -683,10 +672,6 @@ private void savePreferencesData() {
683672

684673
PreferencesData.setBoolean("editor.update_extension", updateExtensionBox.isSelected());
685674

686-
if (autoAssociateBox != null) {
687-
PreferencesData.setBoolean("platform.auto_file_type_associations", autoAssociateBox.isSelected());
688-
}
689-
690675
PreferencesData.setBoolean("editor.save_on_verify", saveVerifyUploadBox.isSelected());
691676

692677
PreferencesData.set("proxy.http.server", proxyHTTPServer.getText());
@@ -744,10 +729,6 @@ private void showPrerefencesData() {
744729

745730
updateExtensionBox.setSelected(PreferencesData.get("editor.update_extension") == null || PreferencesData.getBoolean("editor.update_extension"));
746731

747-
if (autoAssociateBox != null) {
748-
autoAssociateBox.setSelected(PreferencesData.getBoolean("platform.auto_file_type_associations"));
749-
}
750-
751732
saveVerifyUploadBox.setSelected(PreferencesData.getBoolean("editor.save_on_verify"));
752733

753734
proxyHTTPServer.setText(PreferencesData.get("proxy.http.server"));

app/src/processing/app/Base.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,8 @@ static public void guardedMain(String args[]) throws Exception {
146146

147147
initPlatform();
148148

149+
getPlatform().init();
150+
149151
BaseNoGui.initPortableFolder();
150152

151153
BaseNoGui.initParameters(args);
@@ -284,8 +286,6 @@ static public File absoluteFile(String path) {
284286
}
285287

286288
public Base(String[] args) throws Exception {
287-
getPlatform().init();
288-
289289
String sketchbookPath = BaseNoGui.getSketchbookPath();
290290

291291
// If no path is set, get the default sketchbook folder for this platform
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
package processing.app.windows;
2+
3+
import org.junit.Test;
4+
5+
import static org.junit.Assert.assertEquals;
6+
7+
public class RegQueryParserTest {
8+
9+
@Test
10+
public void testRegQueryParser() throws Exception {
11+
String output = "! REG.EXE VERSION 3.0\n" +
12+
"\n" +
13+
"HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders\n" +
14+
"\n" +
15+
" Local AppData REG_SZ C:\\Documents and Settings\\username\\My Documents";
16+
17+
String folderPath = new RegQueryParser(output).getValueOfKey();
18+
assertEquals("C:\\Documents and Settings\\username\\My Documents", folderPath);
19+
}
20+
21+
@Test
22+
public void testRegQueryParser2() throws Exception {
23+
String output = "HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders\n" +
24+
" Local AppData REG_SZ C:\\Users\\username\\AppData\\Local";
25+
26+
String folderPath = new RegQueryParser(output).getValueOfKey();
27+
assertEquals("C:\\Users\\username\\AppData\\Local", folderPath);
28+
}
29+
}

arduino-core/.classpath

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
<classpath>
33
<classpathentry kind="src" path="src"/>
44
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
5-
<classpathentry kind="lib" path="lib/jna.jar"/>
65
<classpathentry kind="lib" path="lib/apple.jar"/>
76
<classpathentry kind="lib" path="lib/commons-logging-1.0.4.jar"/>
87
<classpathentry kind="lib" path="lib/jmdns-3.4.1.jar"/>

arduino-core/lib/jna.LICENSE.LGPL-2.1.txt

-1
This file was deleted.

arduino-core/lib/jna.jar

-611 KB
Binary file not shown.

arduino-core/src/processing/app/BaseNoGui.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -425,8 +425,6 @@ static public String[] headerListFromIncludePath(File path) throws IOException {
425425
}
426426

427427
static public void init(String[] args) throws Exception {
428-
getPlatform().init();
429-
430428
String sketchbookPath = getSketchbookPath();
431429

432430
// If no path is set, get the default sketchbook folder for this platform
@@ -740,7 +738,9 @@ static public void main(String args[]) throws Exception {
740738
Runtime.getRuntime().addShutdownHook(new Thread(DeleteFilesOnShutdown.INSTANCE));
741739

742740
initPlatform();
743-
741+
742+
getPlatform().init();
743+
744744
initPortableFolder();
745745

746746
initParameters(args);

arduino-core/src/processing/app/macosx/Platform.java

+2
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ public Platform() {
5757
}
5858

5959
public void init() throws IOException {
60+
super.init();
61+
6062
System.setProperty("apple.laf.useScreenMenuBar", "true");
6163

6264
discoverRealOsArch();

0 commit comments

Comments
 (0)