Skip to content

Commit

Permalink
review fix
Browse files Browse the repository at this point in the history
  • Loading branch information
lindeer authored and lindeer committed Dec 31, 2023
1 parent e72bf85 commit 58ed8b8
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions pkgs/ffigen/lib/src/config_provider/spec_utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -305,21 +305,27 @@ Headers headersExtractor(
);
}

/// Returns location of dynamic library by searching default locations. Logs
/// error and throws an Exception if not found.
String findDylibAtDefaultLocations() {
String? k;
String? _findLibInConda() {
final condaEnvPath = Platform.environment['CONDA_PREFIX'] ?? '';
if (condaEnvPath.isNotEmpty) {
final localtions = [
final locations = [
p.join(condaEnvPath, 'lib'),
p.join(p.dirname(p.dirname(condaEnvPath)), 'lib'),
];
for (final l in localtions) {
k = findLibclangDylib(l);
for (final l in locations) {
final k = findLibclangDylib(l);
if (k != null) return k;
}
}
return null;
}

/// Returns location of dynamic library by searching default locations. Logs
/// error and throws an Exception if not found.
String findDylibAtDefaultLocations() {
// Assume clang in conda has a higher priority.
var k = _findLibInConda();
if (k != null) return k;
if (Platform.isLinux) {
for (final l in strings.linuxDylibLocations) {
k = findLibclangDylib(l);
Expand Down

0 comments on commit 58ed8b8

Please sign in to comment.