flutter_downloader
flutter_downloader copied to clipboard
add option to change download_tasks.sql path to NSLibraryDirectory on ios
Problem
Currently the download_tasks.sql file is stored in the documents directory on iOS. When one uses UIFileSharingEnabled for example to make downloaded files available in the Files app, download_tasks.sql also show up in that directory. According to Apple one shouldn't store none-user files in the DocumentDirectory. Instead the NSLibraryDirectory is recommended. Moreover the flutter path_provider package suggest to use getLibraryDirectory for database files.

Solution
I suggest to give users the option to specify where they want to store the database file.
I really need this feature too!!
As a quick fix for my project, I changed NSDocumentDirectory to NSApplicationSupportDirectory in the initWithDatabaseFilePath method in DBManager.m file.
FROM NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
TO NSArray *paths = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES);
Hopefully this can be addressed!