mirror of
https://github.com/SkinnyMind/libgit2dart.git
synced 2025-05-04 12:19:09 -04:00
chore: Lookup library in system path (#75)
This commit is contained in:
parent
07e83a1f41
commit
d55742d6d7
1 changed files with 12 additions and 0 deletions
|
@ -53,6 +53,18 @@ String? _resolveLibPath(String name) {
|
|||
libPath = path.join(path.dirname(Platform.resolvedExecutable), 'lib', name);
|
||||
if (_doesFileExist(libPath)) return libPath;
|
||||
|
||||
// If lib is installed in system dir.
|
||||
if (Platform.isMacOS || Platform.isLinux) {
|
||||
final paths = [
|
||||
'/usr/local/lib/libgit2.$libgit2Version.dylib',
|
||||
'/usr/local/lib/libgit2.so.$libgit2Version',
|
||||
'/usr/lib64/libgit2.so.$libgit2Version'
|
||||
];
|
||||
for (final path in paths) {
|
||||
if (_doesFileExist(path)) return path;
|
||||
}
|
||||
}
|
||||
|
||||
String checkCache(PubCache pubCache) {
|
||||
final pubCacheDir =
|
||||
pubCache.getLatestVersion('libgit2dart')!.resolve()!.location;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue