mirror of
https://github.com/arduino/Arduino.git
synced 2025-03-14 11:29:26 +01:00
Windows: msvc*.dll are not found when loading AStyle.dll. Forcing load.
Fixes #4076
This commit is contained in:
parent
90f09e9b38
commit
53987f9db9
@ -30,20 +30,27 @@
|
|||||||
package cc.arduino.packages.formatter;
|
package cc.arduino.packages.formatter;
|
||||||
|
|
||||||
import processing.app.Base;
|
import processing.app.Base;
|
||||||
|
import processing.app.helpers.OSUtils;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
public class AStyleInterface {
|
public class AStyleInterface {
|
||||||
|
|
||||||
static {
|
static {
|
||||||
File astyleLib = new File(Base.getContentFile("lib"), System.mapLibraryName("astylej"));
|
if (OSUtils.isWindows()) {
|
||||||
String astylePath = astyleLib.getAbsolutePath();
|
loadLib(Base.getContentFile(System.mapLibraryName("msvcp100")));
|
||||||
|
loadLib(Base.getContentFile(System.mapLibraryName("msvcr100")));
|
||||||
|
}
|
||||||
|
loadLib(new File(Base.getContentFile("lib"), System.mapLibraryName("astylej")));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void loadLib(File lib) {
|
||||||
try {
|
try {
|
||||||
System.load(astylePath);
|
System.load(lib.getAbsolutePath());
|
||||||
} catch (UnsatisfiedLinkError e) {
|
} catch (UnsatisfiedLinkError e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
System.out.println(e.getMessage());
|
System.out.println(e.getMessage());
|
||||||
System.out.println("Cannot load native library " + astylePath);
|
System.out.println("Cannot load native library " + lib.getAbsolutePath());
|
||||||
System.out.println("The program has terminated!");
|
System.out.println("The program has terminated!");
|
||||||
System.exit(1);
|
System.exit(1);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user