Skip to content

Commit

Permalink
[ffigen] use listSync instead of running ls (#1431)
Browse files Browse the repository at this point in the history
  • Loading branch information
TheComputerM authored Aug 23, 2024
1 parent 3af07fd commit 552428b
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions pkgs/ffigen/lib/src/config_provider/path_finder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,13 @@ List<String> 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;
}
}
}
Expand Down

0 comments on commit 552428b

Please sign in to comment.