mirror of
https://github.com/SkinnyMind/libgit2dart.git
synced 2025-05-04 20:29:08 -04:00
feat: add utilities for library
This commit is contained in:
parent
1414d5f6d7
commit
83da3bb1e8
1 changed files with 21 additions and 0 deletions
21
lib/src/util.dart
Normal file
21
lib/src/util.dart
Normal file
|
@ -0,0 +1,21 @@
|
|||
import 'dart:ffi';
|
||||
import 'dart:io';
|
||||
import 'bindings/libgit2_bindings.dart';
|
||||
|
||||
DynamicLibrary loadLibrary() {
|
||||
if (Platform.isLinux || Platform.isAndroid || Platform.isFuchsia) {
|
||||
return DynamicLibrary.open(
|
||||
'${Directory.current.path}/libgit2-1.1.0/libgit2.so');
|
||||
}
|
||||
if (Platform.isMacOS) {
|
||||
return DynamicLibrary.open(
|
||||
'${Directory.current.path}/libgit2-1.1.0/libgit2.dylib');
|
||||
}
|
||||
if (Platform.isWindows) {
|
||||
return DynamicLibrary.open(
|
||||
'${Directory.current.path}/libgit2-1.1.0/libgit2.dll');
|
||||
}
|
||||
throw Exception('Platform not implemented');
|
||||
}
|
||||
|
||||
final libgit2 = Libgit2(loadLibrary());
|
Loading…
Add table
Add a link
Reference in a new issue