mirror of
https://github.com/Ponsen/cordova-plugin-abi-filter.git
synced 2026-07-28 00:00:07 +08:00
moved recursive function to promise
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "cordova-plugin-abi-filter",
|
||||
"version": "1.1.2",
|
||||
"version": "1.1.3",
|
||||
"description": "Specify supported platform ABIs for your android build",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0" id="cordova-plugin-abi-filter" version="1.1.2">
|
||||
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0" id="cordova-plugin-abi-filter" version="1.1.3">
|
||||
<name>cordova-plugin-abi-filter</name>
|
||||
<description>Filter desired platform ABIs from your project build.</description>
|
||||
<license>Apache 2.0 License</license>
|
||||
|
||||
+20
-19
@@ -13,6 +13,26 @@ module.exports = context => {
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
|
||||
//helper funcs
|
||||
function searchFilesByFilterRecursive(startPath, filter, callback) {
|
||||
|
||||
if (!fs.existsSync(startPath)) {
|
||||
console.log("no dir ", startPath);
|
||||
deferral.reject(new Error("folder " + startPath + " does not exist"))
|
||||
}
|
||||
|
||||
var files = fs.readdirSync(startPath);
|
||||
for (var i = 0; i < files.length; i++) {
|
||||
var filename = path.join(startPath, files[i]);
|
||||
var stat = fs.lstatSync(filename);
|
||||
if (stat.isDirectory()) {
|
||||
searchFilesByFilterRecursive(filename, filter, callback) //recurse
|
||||
} else if (filter.test(filename)) {
|
||||
callback(filename);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
console.log('ABI Filter applying changes...');
|
||||
const projectRoot = context.opts.projectRoot;
|
||||
|
||||
@@ -102,22 +122,3 @@ module.exports = context => {
|
||||
};
|
||||
|
||||
|
||||
//helper funcs
|
||||
function searchFilesByFilterRecursive(startPath, filter, callback) {
|
||||
|
||||
if (!fs.existsSync(startPath)) {
|
||||
console.log("no dir ", startPath);
|
||||
deferral.reject(new Error("folder " + startPath + " does not exist"))
|
||||
}
|
||||
|
||||
var files = fs.readdirSync(startPath);
|
||||
for (var i = 0; i < files.length; i++) {
|
||||
var filename = path.join(startPath, files[i]);
|
||||
var stat = fs.lstatSync(filename);
|
||||
if (stat.isDirectory()) {
|
||||
searchFilesByFilterRecursive(filename, filter, callback) //recurse
|
||||
} else if (filter.test(filename)) {
|
||||
callback(filename);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user