getDefaultLibraryPaths static method

List<String> getDefaultLibraryPaths()

Get default library paths to search

Implementation

static List<String> getDefaultLibraryPaths() {
  final libFileName = getLibraryFileName();
  final currentDir = Directory.current.path;

  final paths = <String>[
    // Relative to current directory
    path.join(currentDir, 'lib', 'native', 'lib', libFileName),
    path.join(currentDir, 'lib', 'native', libFileName),
    path.join(currentDir, 'native', 'lib', libFileName),
    path.join(currentDir, libFileName),

    // Relative to executable
    path.join(
        path.dirname(Platform.resolvedExecutable), 'lib', libFileName),
    path.join(path.dirname(Platform.resolvedExecutable), libFileName),
  ];

  // Add system library paths
  if (Platform.isLinux || Platform.isMacOS) {
    paths.addAll([
      '/usr/local/lib/$libFileName',
      '/usr/lib/$libFileName',
      '/opt/oracle/lib/$libFileName',
    ]);
  }

  return paths;
}