File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
packages/agent_dart_base/test Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change 1
1
// import 'dart:ffi';
2
2
3
+ import 'dart:ffi' ;
4
+
3
5
import 'package:agent_dart_ffi/agent_dart_ffi.dart' ;
4
6
import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated.dart' ;
5
7
import 'package:test/test.dart' ;
@@ -29,8 +31,15 @@ class ErrorMessageMatcher<T extends Error> extends TypeMatcher<T> {
29
31
}
30
32
31
33
Future <void > ffiInit () {
34
+ final [os, arch] = Abi .current ().toString ().split ('_' );
35
+ final libName = switch ((os, arch)) {
36
+ ('macos' , _) || ('linux' , 'arm64' ) => 'libagent_dart.dylib' ,
37
+ ('linux' , '_' ) => 'libagent_dart.so' ,
38
+ ('windows' , '_' ) => 'agent_dart.dll' ,
39
+ _ => throw UnsupportedError ('$os $arch is not a supported platform.' ),
40
+ };
32
41
return AgentDart .init (
33
- externalLibrary: ExternalLibrary .open ('../../target/debug/agent_dart.dll ' ),
42
+ externalLibrary: ExternalLibrary .open ('../../target/debug/$ libName ' ),
34
43
);
35
44
}
36
45
You can’t perform that action at this time.
0 commit comments