mirror of
https://github.com/SkinnyMind/libgit2dart.git
synced 2025-05-04 20:29:08 -04:00
fix: lookup library in correct locations (#64)
This commit is contained in:
parent
5739de545b
commit
b0b8067203
3 changed files with 21 additions and 32 deletions
|
@ -23,15 +23,23 @@ Future<void> copyLibrary(String platform) async {
|
|||
);
|
||||
}
|
||||
} else {
|
||||
final pubCache = PubCache();
|
||||
final pubCacheDir =
|
||||
pubCache.getLatestVersion('libgit2dart')!.resolve()!.location;
|
||||
String? checkCache(PubCache pubCache) =>
|
||||
pubCache.getLatestVersion('libgit2dart')?.resolve()?.location.path;
|
||||
|
||||
final libPath = checkCache(PubCache()) ??
|
||||
checkCache(
|
||||
PubCache(
|
||||
Directory(
|
||||
path.join(Platform.environment['FLUTTER_ROOT']!, '.pub-cache'),
|
||||
),
|
||||
),
|
||||
);
|
||||
final libName = getLibName();
|
||||
|
||||
stdout.writeln('Copying libgit2 for $platform');
|
||||
final destination = path.join(libDir, platform);
|
||||
Directory(destination).createSync(recursive: true);
|
||||
File(path.join(pubCacheDir.path, platform, libName)).copySync(
|
||||
File(path.join(libPath!, platform, libName)).copySync(
|
||||
path.join(destination, libName),
|
||||
);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue