Handles all the Java-specific parsing for library handling.
()
| 124 | * Handles all the Java-specific parsing for library handling. |
| 125 | */ |
| 126 | protected void handle() { |
| 127 | File exportSettings = new File(libraryFolder, "export.txt"); |
| 128 | StringDict exportTable = exportSettings.exists() ? |
| 129 | Util.readSettings(exportSettings) : new StringDict(); |
| 130 | |
| 131 | exportList = new HashMap<>(); |
| 132 | |
| 133 | // get the list of files just in the library root |
| 134 | String[] baseList = libraryFolder.list(standardFilter); |
| 135 | // System.out.println("Loading " + name + "..."); |
| 136 | // PApplet.println(baseList); |
| 137 | |
| 138 | String appletExportStr = exportTable.get("applet"); |
| 139 | if (appletExportStr != null) { |
| 140 | appletExportList = PApplet.splitTokens(appletExportStr, ", "); |
| 141 | } else { |
| 142 | appletExportList = baseList; |
| 143 | } |
| 144 | |
| 145 | String androidExportStr = exportTable.get("android"); |
| 146 | if (androidExportStr != null) { |
| 147 | androidExportList = PApplet.splitTokens(androidExportStr, ", "); |
| 148 | } else { |
| 149 | androidExportList = baseList; |
| 150 | } |
| 151 | |
| 152 | // for the host platform, need to figure out what's available |
| 153 | File nativeLibraryFolder = libraryFolder; |
| 154 | String hostPlatform = Platform.getName(); |
| 155 | // System.out.println("1 native lib folder now " + nativeLibraryFolder); |
| 156 | // see if there's a 'windows', 'macosx', or 'linux' folder |
| 157 | File hostLibrary = new File(libraryFolder, hostPlatform); |
| 158 | if (hostLibrary.exists()) { |
| 159 | nativeLibraryFolder = hostLibrary; |
| 160 | } |
| 161 | // System.out.println("2 native lib folder now " + nativeLibraryFolder); |
| 162 | // check for bit-specific version, e.g. on windows, check if there |
| 163 | // is a window32 or windows64 folder (on windows) |
| 164 | hostLibrary = |
| 165 | new File(libraryFolder, hostPlatform + Platform.getNativeBits()); |
| 166 | if (hostLibrary.exists()) { |
| 167 | nativeLibraryFolder = hostLibrary; |
| 168 | } |
| 169 | // System.out.println("3 native lib folder now " + nativeLibraryFolder); |
| 170 | |
| 171 | if (hostPlatform.equals("linux") && System.getProperty("os.arch").equals("arm")) { |
| 172 | hostLibrary = new File(libraryFolder, "linux-armv6hf"); |
| 173 | if (hostLibrary.exists()) { |
| 174 | nativeLibraryFolder = hostLibrary; |
| 175 | } |
| 176 | } |
| 177 | if (hostPlatform.equals("linux") && System.getProperty("os.arch").equals("aarch64")) { |
| 178 | hostLibrary = new File(libraryFolder, "linux-arm64"); |
| 179 | if (hostLibrary.exists()) { |
| 180 | nativeLibraryFolder = hostLibrary; |
| 181 | } |
| 182 | } |
| 183 |
no test coverage detected