}
if (!nativeFolder.isDirectory()) {
// not a directory? check if it's a file or doesn't exist
if (nativeFolder.exists()) {
throw new PackagerException("%s is not a folder", nativeFolder);
} else {
throw new PackagerException("%s does not exist", nativeFolder);
}
}
File[] abiList = nativeFolder.listFiles();
mLogger.verbose("Native folder: %s", nativeFolder);
if (abiList != null) {
for (File abi : abiList) {
if (abiFilters != null && !abiFilters.contains(abi.getName())) {
continue;
}
if (abi.isDirectory()) { // ignore files
File[] libs = abi.listFiles();
if (libs != null) {
for (File lib : libs) {
// only consider files that are .so or, if in debug mode, that
// are gdbserver executables
String libName = lib.getName();
if (lib.isFile() &&
(PATTERN_NATIVELIB_EXT.matcher(lib.getName()).matches() ||
(mJniDebugMode &&
(SdkConstants.FN_GDBSERVER.equals(libName) ||
SdkConstants.FN_GDB_SETUP.equals(libName))))) {
String path =
SdkConstants.FD_APK_NATIVE_LIBS + "/" +
abi.getName() + "/" + libName;
try {
doAddFile(lib, path);
} catch (IOException e) {
mBuilder.cleanUp();
throw new PackagerException(e, "Failed to add %s", lib);
}
}
}
}
}