findFiles method
Detects the list of library files to inspect from the program arguments
.
Implementation
Future<List<String>> findFiles(List<String> arguments) async {
final rc = <String>[];
if (arguments.isEmpty) {
arguments = [libDirectory];
}
for (var arg in arguments) {
if (await FileSystemEntity.isDirectory(arg)) {
final directory = Directory(arg);
if (await directory.exists()) {
final files = await directory.list().toList();
for (var file in files) {
if (file.path.endsWith('.so')) {
rc.add(file.path);
}
}
}
} else if (await FileSystemEntity.isFile(arg)) {
final file = File(arg);
if (arg.endsWith('.so') && await file.exists()) {
rc.add(arg);
}
}
}
return rc;
}