Skip to content

Commit d65e6ff

Browse files
authored
Merge pull request #6331 from cmaglie/jssc-no-unpack
Two fix for future Windows compatibility
2 parents 666ac02 + bb41ad7 commit d65e6ff

File tree

8 files changed

+47
-19
lines changed

8 files changed

+47
-19
lines changed

app/.classpath

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
<classpathentry kind="lib" path="lib/slf4j-api-1.7.22.jar"/>
4343
<classpathentry kind="lib" path="lib/slf4j-simple-1.7.22.jar"/>
4444
<classpathentry kind="lib" path="lib/jsch-0.1.50.jar"/>
45-
<classpathentry kind="lib" path="lib/jssc-2.8.0.jar"/>
45+
<classpathentry kind="lib" path="lib/jssc-2.8.0-arduino1.jar"/>
4646
<classpathentry kind="lib" path="lib/rsyntaxtextarea-2.6.1.jar"/>
4747
<classpathentry kind="lib" path="lib/xml-apis-1.3.04.jar"/>
4848
<classpathentry kind="lib" path="lib/xml-apis-ext-1.3.04.jar"/>
Binary file not shown.

arduino-core/.classpath

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<classpathentry kind="lib" path="lib/jmdns-3.5.1.jar"/>
99
<classpathentry kind="lib" path="lib/slf4j-api-1.7.22.jar"/>
1010
<classpathentry kind="lib" path="lib/slf4j-simple-1.7.22.jar"/>
11-
<classpathentry kind="lib" path="lib/jssc-2.8.0.jar"/>
11+
<classpathentry kind="lib" path="lib/jssc-2.8.0-arduino1.jar"/>
1212
<classpathentry kind="lib" path="lib/jsch-0.1.50.jar"/>
1313
<classpathentry kind="lib" path="lib/commons-exec-1.1.jar"/>
1414
<classpathentry kind="lib" path="../app/lib/commons-codec-1.7.jar"/>

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

+14-15
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737

3838
import com.sun.jna.Native;
3939
import com.sun.jna.Pointer;
40+
import com.sun.jna.platform.win32.Shell32;
4041
import com.sun.jna.win32.StdCallLibrary;
4142
import com.sun.jna.win32.W32APIOptions;
4243

@@ -129,11 +130,15 @@ public void openURL(String url) throws Exception {
129130
if (file.exists()) {
130131
// in this case convert the path to a "file:" url
131132
url = file.toURI().toString();
132-
133-
// this allows to open the file on Windows 10 that
134-
// has a more strict permission policy for cmd.exe
135133
}
136134
}
135+
if (url.startsWith("http") || url.startsWith("file:")) {
136+
// this allows to open the file on Windows 10 that
137+
// has a more strict permission policy for cmd.exe
138+
final int SW_SHOW = 5;
139+
Shell32.INSTANCE.ShellExecute(null, null, url, null, null, SW_SHOW);
140+
return;
141+
}
137142

138143
// this is not guaranteed to work, because who knows if the
139144
// path will always be c:\progra~1 et al. also if the user has
@@ -150,18 +155,12 @@ public void openURL(String url) throws Exception {
150155
// "Access is denied" in both cygwin and the "dos" prompt.
151156
//Runtime.getRuntime().exec("cmd /c " + currentDir + "\\reference\\" +
152157
// referenceFile + ".html");
153-
if (url.startsWith("http") || url.startsWith("file:")) {
154-
// open dos prompt, give it 'start' command, which will
155-
// open the url properly. start by itself won't work since
156-
// it appears to need cmd
157-
Runtime.getRuntime().exec("cmd /c start \"\" \"" + url + "\"");
158-
} else {
159-
// just launching the .html file via the shell works
160-
// but make sure to chmod +x the .html files first
161-
// also place quotes around it in case there's a space
162-
// in the user.dir part of the url
163-
Runtime.getRuntime().exec("cmd /c \"" + url + "\"");
164-
}
158+
159+
// just launching the .html file via the shell works
160+
// but make sure to chmod +x the .html files first
161+
// also place quotes around it in case there's a space
162+
// in the user.dir part of the url
163+
Runtime.getRuntime().exec("cmd /c \"" + url + "\"");
165164
}
166165

167166

build/build.xml

+27
Original file line numberDiff line numberDiff line change
@@ -1037,6 +1037,33 @@
10371037
<param name="file" value="windows/work/lib/jnidispatch-4.2.2-win32-x86.dll" />
10381038
</antcall>
10391039

1040+
<exec executable="unzip" failonerror="true">
1041+
<arg value="-q" />
1042+
<arg value="-n" />
1043+
<arg value="-j" />
1044+
<arg value="-d" />
1045+
<arg value="windows/work/lib" />
1046+
<arg value="../arduino-core/lib/jssc-2.8.0-arduino1.jar" />
1047+
<arg value="libs/windows/jSSC-2.8_x86.dll" />
1048+
</exec>
1049+
<move file="windows/work/lib/jSSC-2.8_x86.dll" tofile="windows/work/lib/jSSC-2.8_x86.dll" />
1050+
<antcall target="make-file-executable">
1051+
<param name="file" value="windows/work/lib/jSSC-2.8_x86.dll" />
1052+
</antcall>
1053+
<exec executable="unzip" failonerror="true">
1054+
<arg value="-q" />
1055+
<arg value="-n" />
1056+
<arg value="-j" />
1057+
<arg value="-d" />
1058+
<arg value="windows/work/lib" />
1059+
<arg value="../arduino-core/lib/jssc-2.8.0-arduino1.jar" />
1060+
<arg value="libs/windows/jSSC-2.8_x86_64.dll" />
1061+
</exec>
1062+
<move file="windows/work/lib/jSSC-2.8_x86_64.dll" tofile="windows/work/lib/jSSC-2.8_x86_64.dll" />
1063+
<antcall target="make-file-executable">
1064+
<param name="file" value="windows/work/lib/jSSC-2.8_x86_64.dll" />
1065+
</antcall>
1066+
10401067
<antcall target="assemble">
10411068
<param name="target.path" value="windows/work" />
10421069
</antcall>

build/windows/launcher/config.xml

+2-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
<cp>%EXEDIR%/lib/jna-4.2.2.jar</cp>
4848
<cp>%EXEDIR%/lib/jna-platform-4.2.2.jar</cp>
4949
<cp>%EXEDIR%/lib/jsch-0.1.50.jar</cp>
50-
<cp>%EXEDIR%/lib/jssc-2.8.0.jar</cp>
50+
<cp>%EXEDIR%/lib/jssc-2.8.0-arduino1.jar</cp>
5151
<cp>%EXEDIR%/lib/pde.jar</cp>
5252
<cp>%EXEDIR%/lib/rsyntaxtextarea-2.6.1.jar</cp>
5353
<cp>%EXEDIR%/lib/xml-apis-1.3.04.jar</cp>
@@ -63,6 +63,7 @@
6363
<opt>-Djna.nounpack=true</opt>
6464
<opt>-Djna.boot.library.name=jnidispatch-4.2.2-win32-x86</opt>
6565
<opt>-Djna.boot.library.path="%EXEDIR%"/lib</opt>
66+
<opt>-Djssc.library.path="%EXEDIR%"/lib</opt>
6667
<opt>-DAPP_DIR="%EXEDIR%"</opt>
6768
</jre>
6869
<versionInfo>

build/windows/launcher/config_debug.xml

+2-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
<cp>%EXEDIR%/lib/jna-4.2.2.jar</cp>
4848
<cp>%EXEDIR%/lib/jna-platform-4.2.2.jar</cp>
4949
<cp>%EXEDIR%/lib/jsch-0.1.50.jar</cp>
50-
<cp>%EXEDIR%/lib/jssc-2.8.0.jar</cp>
50+
<cp>%EXEDIR%/lib/jssc-2.8.0-arduino1.jar</cp>
5151
<cp>%EXEDIR%/lib/pde.jar</cp>
5252
<cp>%EXEDIR%/lib/rsyntaxtextarea-2.6.1.jar</cp>
5353
<cp>%EXEDIR%/lib/xml-apis-1.3.04.jar</cp>
@@ -62,6 +62,7 @@
6262
<opt>-Djna.nounpack=true</opt>
6363
<opt>-Djna.boot.library.name=jnidispatch-4.2.2-win32-x86</opt>
6464
<opt>-Djna.boot.library.path="%EXEDIR%"/lib</opt>
65+
<opt>-Djssc.library.path="%EXEDIR%"/lib</opt>
6566
<opt>-Djna.debug_load=true</opt>
6667
<opt>-DAPP_DIR="%EXEDIR%"</opt>
6768
<opt>-DDEBUG=true</opt>

0 commit comments

Comments
 (0)