|
30 | 30 | package cc.arduino.packages.formatter;
|
31 | 31 |
|
32 | 32 | import processing.app.Base;
|
| 33 | +import processing.app.helpers.OSUtils; |
33 | 34 |
|
34 | 35 | import java.io.File;
|
35 | 36 |
|
36 | 37 | public class AStyleInterface {
|
37 | 38 |
|
38 | 39 | static {
|
39 | | - File astyleLib = new File(Base.getContentFile("lib"), System.mapLibraryName("astylej")); |
40 | | - String astylePath = astyleLib.getAbsolutePath(); |
| 40 | + if (OSUtils.isWindows()) { |
| 41 | + loadLib(Base.getContentFile(System.mapLibraryName("msvcp100"))); |
| 42 | + loadLib(Base.getContentFile(System.mapLibraryName("msvcr100"))); |
| 43 | + } |
| 44 | + loadLib(new File(Base.getContentFile("lib"), System.mapLibraryName("astylej"))); |
| 45 | + } |
| 46 | + |
| 47 | + private static void loadLib(File lib) { |
41 | 48 | try {
|
42 | | - System.load(astylePath); |
| 49 | + System.load(lib.getAbsolutePath()); |
43 | 50 | } catch (UnsatisfiedLinkError e) {
|
44 | 51 | e.printStackTrace();
|
45 | 52 | System.out.println(e.getMessage());
|
46 | | - System.out.println("Cannot load native library " + astylePath); |
| 53 | + System.out.println("Cannot load native library " + lib.getAbsolutePath()); |
47 | 54 | System.out.println("The program has terminated!");
|
48 | 55 | System.exit(1);
|
49 | 56 | }
|
|
0 commit comments