findWindowsSqlite3DllPath function
Find windows dll path.
Implementation
String? findWindowsSqlite3DllPath() {
var location = findPackageLibPath(Directory.current.path);
if (location == null) {
// Try to handle when using global run
// When using `global run` we might not be able to find the lib path.
// Try from the script
// when running using global run: file:///C:/oxxxdevx/git/github.com/tekartik/sqflite/packages/console_test_app/.dart_tool/pub/bin/sqflite_ffi_console_test_app/sqflite_ffi_simple_bin.dart-2.19.0.snapshot
// when running normally: C:\xxx\devx\git\github.com\tekartik\sqflite\packages\console_test_app\bin\sqflite_ffi_simple_bin.dart
// When running hoster: C:\Users\xxx\AppData\Local\Pub\Cache\bin\pubglobalupdate.bat
try {
// This the case when activated from path...ugly but worth trying.
var projectPath = dirname(
dirname(dirname(dirname(dirname(Platform.script.toFilePath())))));
location = findPackageLibPath(projectPath);
} catch (_) {}
}
if (location != null) {
var path = packageGetSqlite3DllPath(normalize(join(location)));
return path;
}
return null;
}