Merge pull request #6331 from cmaglie/jssc-no-unpack

Two fix for future Windows compatibility
This commit is contained in:
Cristian Maglie 2017-05-30 15:58:10 +02:00 committed by GitHub
commit d65e6ffc3d
8 changed files with 47 additions and 19 deletions

View File

@ -42,7 +42,7 @@
<classpathentry kind="lib" path="lib/slf4j-api-1.7.22.jar"/>
<classpathentry kind="lib" path="lib/slf4j-simple-1.7.22.jar"/>
<classpathentry kind="lib" path="lib/jsch-0.1.50.jar"/>
<classpathentry kind="lib" path="lib/jssc-2.8.0.jar"/>
<classpathentry kind="lib" path="lib/jssc-2.8.0-arduino1.jar"/>
<classpathentry kind="lib" path="lib/rsyntaxtextarea-2.6.1.jar"/>
<classpathentry kind="lib" path="lib/xml-apis-1.3.04.jar"/>
<classpathentry kind="lib" path="lib/xml-apis-ext-1.3.04.jar"/>

Binary file not shown.

View File

@ -8,7 +8,7 @@
<classpathentry kind="lib" path="lib/jmdns-3.5.1.jar"/>
<classpathentry kind="lib" path="lib/slf4j-api-1.7.22.jar"/>
<classpathentry kind="lib" path="lib/slf4j-simple-1.7.22.jar"/>
<classpathentry kind="lib" path="lib/jssc-2.8.0.jar"/>
<classpathentry kind="lib" path="lib/jssc-2.8.0-arduino1.jar"/>
<classpathentry kind="lib" path="lib/jsch-0.1.50.jar"/>
<classpathentry kind="lib" path="lib/commons-exec-1.1.jar"/>
<classpathentry kind="lib" path="../app/lib/commons-codec-1.7.jar"/>

Binary file not shown.

View File

@ -37,6 +37,7 @@ import java.util.List;
import com.sun.jna.Native;
import com.sun.jna.Pointer;
import com.sun.jna.platform.win32.Shell32;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;
@ -129,11 +130,15 @@ public class Platform extends processing.app.Platform {
if (file.exists()) {
// in this case convert the path to a "file:" url
url = file.toURI().toString();
// this allows to open the file on Windows 10 that
// has a more strict permission policy for cmd.exe
}
}
if (url.startsWith("http") || url.startsWith("file:")) {
// this allows to open the file on Windows 10 that
// has a more strict permission policy for cmd.exe
final int SW_SHOW = 5;
Shell32.INSTANCE.ShellExecute(null, null, url, null, null, SW_SHOW);
return;
}
// this is not guaranteed to work, because who knows if the
// path will always be c:\progra~1 et al. also if the user has
@ -150,18 +155,12 @@ public class Platform extends processing.app.Platform {
// "Access is denied" in both cygwin and the "dos" prompt.
//Runtime.getRuntime().exec("cmd /c " + currentDir + "\\reference\\" +
// referenceFile + ".html");
if (url.startsWith("http") || url.startsWith("file:")) {
// open dos prompt, give it 'start' command, which will
// open the url properly. start by itself won't work since
// it appears to need cmd
Runtime.getRuntime().exec("cmd /c start \"\" \"" + url + "\"");
} else {
// just launching the .html file via the shell works
// but make sure to chmod +x the .html files first
// also place quotes around it in case there's a space
// in the user.dir part of the url
Runtime.getRuntime().exec("cmd /c \"" + url + "\"");
}
// just launching the .html file via the shell works
// but make sure to chmod +x the .html files first
// also place quotes around it in case there's a space
// in the user.dir part of the url
Runtime.getRuntime().exec("cmd /c \"" + url + "\"");
}

View File

@ -1037,6 +1037,33 @@
<param name="file" value="windows/work/lib/jnidispatch-4.2.2-win32-x86.dll" />
</antcall>
<exec executable="unzip" failonerror="true">
<arg value="-q" />
<arg value="-n" />
<arg value="-j" />
<arg value="-d" />
<arg value="windows/work/lib" />
<arg value="../arduino-core/lib/jssc-2.8.0-arduino1.jar" />
<arg value="libs/windows/jSSC-2.8_x86.dll" />
</exec>
<move file="windows/work/lib/jSSC-2.8_x86.dll" tofile="windows/work/lib/jSSC-2.8_x86.dll" />
<antcall target="make-file-executable">
<param name="file" value="windows/work/lib/jSSC-2.8_x86.dll" />
</antcall>
<exec executable="unzip" failonerror="true">
<arg value="-q" />
<arg value="-n" />
<arg value="-j" />
<arg value="-d" />
<arg value="windows/work/lib" />
<arg value="../arduino-core/lib/jssc-2.8.0-arduino1.jar" />
<arg value="libs/windows/jSSC-2.8_x86_64.dll" />
</exec>
<move file="windows/work/lib/jSSC-2.8_x86_64.dll" tofile="windows/work/lib/jSSC-2.8_x86_64.dll" />
<antcall target="make-file-executable">
<param name="file" value="windows/work/lib/jSSC-2.8_x86_64.dll" />
</antcall>
<antcall target="assemble">
<param name="target.path" value="windows/work" />
</antcall>

View File

@ -47,7 +47,7 @@
<cp>%EXEDIR%/lib/jna-4.2.2.jar</cp>
<cp>%EXEDIR%/lib/jna-platform-4.2.2.jar</cp>
<cp>%EXEDIR%/lib/jsch-0.1.50.jar</cp>
<cp>%EXEDIR%/lib/jssc-2.8.0.jar</cp>
<cp>%EXEDIR%/lib/jssc-2.8.0-arduino1.jar</cp>
<cp>%EXEDIR%/lib/pde.jar</cp>
<cp>%EXEDIR%/lib/rsyntaxtextarea-2.6.1.jar</cp>
<cp>%EXEDIR%/lib/xml-apis-1.3.04.jar</cp>
@ -63,6 +63,7 @@
<opt>-Djna.nounpack=true</opt>
<opt>-Djna.boot.library.name=jnidispatch-4.2.2-win32-x86</opt>
<opt>-Djna.boot.library.path="%EXEDIR%"/lib</opt>
<opt>-Djssc.library.path="%EXEDIR%"/lib</opt>
<opt>-DAPP_DIR="%EXEDIR%"</opt>
</jre>
<versionInfo>

View File

@ -47,7 +47,7 @@
<cp>%EXEDIR%/lib/jna-4.2.2.jar</cp>
<cp>%EXEDIR%/lib/jna-platform-4.2.2.jar</cp>
<cp>%EXEDIR%/lib/jsch-0.1.50.jar</cp>
<cp>%EXEDIR%/lib/jssc-2.8.0.jar</cp>
<cp>%EXEDIR%/lib/jssc-2.8.0-arduino1.jar</cp>
<cp>%EXEDIR%/lib/pde.jar</cp>
<cp>%EXEDIR%/lib/rsyntaxtextarea-2.6.1.jar</cp>
<cp>%EXEDIR%/lib/xml-apis-1.3.04.jar</cp>
@ -62,6 +62,7 @@
<opt>-Djna.nounpack=true</opt>
<opt>-Djna.boot.library.name=jnidispatch-4.2.2-win32-x86</opt>
<opt>-Djna.boot.library.path="%EXEDIR%"/lib</opt>
<opt>-Djssc.library.path="%EXEDIR%"/lib</opt>
<opt>-Djna.debug_load=true</opt>
<opt>-DAPP_DIR="%EXEDIR%"</opt>
<opt>-DDEBUG=true</opt>