flutter_downloader icon indicating copy to clipboard operation
flutter_downloader copied to clipboard

add option to change download_tasks.sql path to NSLibraryDirectory on ios

Open The-Redhat opened this issue 5 years ago • 2 comments

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.

photo5228850717417123257

Solution

I suggest to give users the option to specify where they want to store the database file.

The-Redhat avatar Jul 17 '20 09:07 The-Redhat

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);

claptv avatar Sep 15 '21 01:09 claptv

Hopefully this can be addressed!

hsynaksu avatar Jul 27 '22 12:07 hsynaksu