diff --git a/pkgs/ffigen/lib/src/config_provider/path_finder.dart b/pkgs/ffigen/lib/src/config_provider/path_finder.dart index 51044103b..7d7bd47ff 100644 --- a/pkgs/ffigen/lib/src/config_provider/path_finder.dart +++ b/pkgs/ffigen/lib/src/config_provider/path_finder.dart @@ -32,17 +32,13 @@ List getCStandardLibraryHeadersForMac() { for (final searchPath in searchPaths) { if (!Directory(searchPath).existsSync()) continue; - final result = Process.runSync('ls', [searchPath]); - final stdout = result.stdout as String; - if (stdout != '') { - final versions = stdout.split('\n').where((s) => s != ''); - for (final version in versions) { - final path = p.join(searchPath, version, 'include'); - if (Directory(path).existsSync()) { - _logger.fine('Added stdlib path: $path to compiler-opts.'); - includePaths.add('-I$path'); - return includePaths; - } + final versions = Directory(searchPath).listSync(); + for (final version in versions) { + final path = p.join(version.path, 'include'); + if (Directory(path).existsSync()) { + _logger.fine('Added stdlib path: $path to compiler-opts.'); + includePaths.add('-I$path'); + return includePaths; } } }