I am using this code to cache files on my local storage:
var audioFile = await DefaultCacheManager().getSingleFile('fileUrl');
I need to physically access the file to see if the user can access it from the file manager. When I run the app, the files are being cached. But I can not find the path where the files are cached on the device.
This is the address that I get on debug mode:
"/data/user/0/{my_package_name}/cache/libCachedImageData/3a65ece0-5366-11eb-91e0-0f0ba53cd292.mp4"
But there is no such path on my device.
It is a path to a "hiden" folders on your device. You can navigate to this path with root privileges or get (and navigate) the data by tutorials like this. Also you can find this folders without any permissions on Android emulator from File Explorer tab in Android Studio.
Related
I messed up by denying vs code to read my "download files", however, I believe this is an issue found on mac's permission settings (in which I don't know where to find it). I say this because when I downloaded a firebase file (GoogleService-Info (2).plist) I am able to run it in Xcode but not in Vs Code. How can I allow Vs code to read all download files?
Apple icon - system preferences - privacy
Select Files and Folders.
Select the checkbox below an app to allow it to access files and folders in that location.
I am building a flutter app (iOS/Android/MacOS/Windows/Web) which is able to download files, selected by the user. But where should I save those files? On MacOS/Windows its easy using path_provider and get the path of the downloads folder.
But where should I save the files on the other platforms? The downloads folder would be perfect because the users are able to use those files (.pdf) even without using the app, so the files are not app specific.
If you wish to save in download directory you can use
Directory appDownloadDir = await getDownloadsDirectory();
String appDownloadPath = appDownloadDir.path;
Or
getExternalStorageDirectory()//android
getApplicationDocumentsDirectory()// ios doesnt support access to download folder
My flutter desktop application takes a local file (audio/video/image) as user input. Now I need to save it to somewhere for later usage. So that even if the device changes the application can still access them using relative path.
What I want to do is copy this file to assets folder using file.copy method. But how can I get the assets folder's directory? I don't want to hardcode assets folder's absolute path. Is there any way to copy files into assets folder using relative path?
Or any alternate way to do the task?
assets is read-only. Use documents directory where the application can store files that only it can access.
final directory = await getApplicationDocumentsDirectory();
See Read and write files for details.
My problem is that the portable version of visual studio code don't load my settings I had copied from the folder %APPDATA%/code/user.
I loaded the .zip data and extracted the folder. I added a data folder into the extracted folder of VS Code. It's in Visual Studio Code\data. In there i copied the folder "user" from %APPDATA%/code/ and renamed the user folder into "user-data". Then I started code and the usersettings are not loaded.
The command .\code.exe --user-directory .\data\user-data won't work.
Is this a bug or did I do something wrong?
In portable mode, the --user-directory command linte option is ignored.
From the documentation:
--user-data-dir <dir>
Specifies the directory that user data is kept in, useful when running as root. Has no effect in Portable Mode.
Instead, use the default location of user data for a portable install and copy your user data to that directory (from a previous comment it seems like you've already done so successfuly).
For anyone wishing to use a different user data directory when in portable mode, symlink-ing the user data folder should be a viable option if on a linux-like platform.
(Trivia: this was at first reported as bug, after which the documentation was updated, rather making it a feature.)
You can simply create a folder called data in the root folder with
VS Code.
After the startup, the files with standard settings will be
created in the data folder.
Then you can just copy the settings from the folder %AppData%\Code\User to the folder data\user-data\User.
To migrate already installed extensions, copy the contents of the %HomePath%\.vscode\extensions folder to the data\extensions folder.
I have developed an application which read text file. In Emulator I have push the file in
\Data\Data\PackageName\File.txt and its working fine. But when I try to push file in Device its generate the error Read Only File System. I have try to remount directory as writable but the same error. Please help me how can I push file into device.
The folder you are trying is locked on non-rooted phones i.e no write permission and I guess the device you are trying on is not a rooted one. since emulator is sort of developer device which is said to be rooted that's why you can push file to that location.
So depending on your requirement you have to either use Assest folder or File system storage
Update: How to use assest folder
Resources r = getResources();
AssetManager assetManager = r.getAssets();
InputStream in = assetManager.open(filename);
In practice, we can push such file in assets folder. Assets folder is there for you to put such raw files to be used inside the application.