Closed filipenanclarez closed 2 years ago
Hey
Can you please try this with the assets_directory_path
folder,
See: https://github.com/YehudaKremer/msix#file_folder-dll-files-and-assets-ffi-library
Let see if its resolve the admin problem
Hey
Can you please try this with the
assets_directory_path
folder, See: https://github.com/YehudaKremer/msix#file_folder-dll-files-and-assets-ffi-libraryLet see if its resolve the admin problem
I already tried, but the package put the dll in a subfolder, then not work. How can i do to make package put the dll in root folder?
Please try this: #72 (comment)
Tried, but problem still works.
But i found the problem.
Not related to your package, sorry for this.
But if somebody need the solution, here a explanation:
When chosse the path of database file, if we use this function databaseFactoryFfi.getDatabasesPath()
then the location of final release return c:\windows\system32\.dart_tool\sqflite_common_ffi\databases
. But this directory require admin permissions to read/write.
So for fix, i change my code to use path_provider and get the directory with getApplicationSupportDirectory()
function. Then everything works now.
Here my peace of code for who need help:
BEFORE:
Future<Database> openConnection() async {
sqfliteFfiInit();
final databasePah = await databaseFactoryFfi.getDatabasesPath(); <<< HERE THE PROBLEM
var databasePathFinal = join(databasePah.path, _DATABASE_NAME);
DatabaseFactory databaseFactory = databaseFactoryFfi;
_db = await databaseFactory.openDatabase(databasePathFinal,
options: OpenDatabaseOptions( ...
...
AFTER:
Future<Database> openConnection() async {
sqfliteFfiInit();
final databasePah = await pathprovider.getApplicationSupportDirectory(); <<< HERE THE SOLUTION
var databasePathFinal = join(databasePah.path, _DATABASE_NAME);
DatabaseFactory databaseFactory = databaseFactoryFfi;
_db = await databaseFactory.openDatabase(databasePathFinal,
options: OpenDatabaseOptions( ...
...
Wonderful👍 Thanks for sharing your solution
:information_source: Info
Version:
v2.8.1
:speech_balloon: Description
After
flutter build windows
i put sqlite3.dll on output folder. Then runflutter pub run msix:create
. Then make install with msix in a new clean computer. In app folderc:\program files\windowsapps\myapp
the sqlite3.dll is there, alright. But if i run the app from start menu, app cannot load dll. If i run from the folder, then app can load dll and works correctly. If i run from start menu as admin, then app can load dll and works correctly. So i think problem is related with some permissions to run with capabilities to execute thirty party dlls, but i can't find in documentation. I'm usinghttps://pub.dev/packages/sqflite_common_ffi
package, and if i run .exe from folder, with sqlite3.dll on same folder as .exe, work correctly. Only with msix instalation and then run from start menu as common user is problem.:scroll: Pubspec.yaml