Flutter file picker creates symlinks - android

I have battled this issue for sometime now and i seem to be going nowhere, I am using file_picker flutter plugin, its working on devices with android v7, now am running the app on emulator with android v9 and the filepicker creates symlink, here is a log:
I/FilePickerUtils( 7999): File loaded and cached at:/data/user/0/com.lulliezy.videostatus/cache/file_picker/KHALIGRAPH JONES x SARKODIE - WAVY (OFFICIAL VIDEO).webm
I/FilePickerDelegate( 7999): Absolute file path:/data/user/0/com.lulliezy.videostatus/cache/file_picker/KHALIGRAPH JONES x SARKODIE - WAVY (OFFICIAL VIDEO).webm
Now my understanding bt the word cached is a symlink is created, now how do i disable this feature or rather, get the original file name with this code:
await FilePicker.getFile(
type: FileType.custom,
allowedExtensions: ['mp4', 'webm'],
);
Thanks in advance.
EDIT
I should clarify, am using flutter ffmpeg so it complains with file does not exists.

I actually found a workaround for this, I copied the picked file to another temporary directory and used that new path after which when am done, I delete the copied file.

Related

Flutter getApplicationDocumentsDirectory() returns a path different from Device file explorer

My getApplicationDocumentsDirectory() is returning me
/data/user/0/com.my.applicationname/app_flutter
While when using the device file explorer(and using "copy path" option),this directory comes up as
/data/data/com.my.applicationname/app_flutter
This is causing issues as when I try to play a file stored using above path prefix(using the uri as Uri.file(fileNameFromAbovePrefix), the file is not being found(whereas if I manually copy the path from device explorer and paste in Uri.file, it works).
My path_provider pluting version is ^2.0.1
So how do I get the path that actually works with uri(in a reliable way across all android devices)?

Cannot copying file from Android to Linuxmint 17.3 Desktop "libmtp error: Could not get file from device"

I am trying to copy image file to backup it on my desktop which is linux mint (17.3 or Rosa) installed. I am using Infinix X510 phone with the newest version of android 6. At the beginning it was OK. But, at the end i get the message
“libmtp error: Could not get file from device”
I tried the solution as found by Googling here https://askubuntu.com/questions/879029/libmtp-error-could-not-get-file-from-device-on-attempting-to-transfer-files
But, it wasn't working for me. Is there a way to solve this matter? I need file to support my company job which supplying cosmetics.
Try compressing the file to a compressed format(tar,zip).Copy the file and then decompress it.
Changing the filename was the solution for me e.g: file.mkv to file.zip
Try to rename file, make sure file name not contain (-) (:) etc. Just rename it to alphabet

QPython - Reading a file

I have installed QPython in my Android mobile.
I written a statement in the QEdit to read a text file from the below path
/storage/emulated/0/com.hipipal.qpyplus/script3/File1.txt
I used the below statement
fob=open('/storage/emulated/0/com.hipipal.qpyplus/script3/File1.txt','r')
fob.read()
If I run the statement, it is throwing error as:
IOError:[Errno 2] No such file or directory: '/storage/emulated/0/com.hipipal.qpyplus/script3/File1.txt'
1|uo_a116#cancro:/ $
Is the above statement correct?
fob=open('File1.txt','r')
Is not working in version 1.0.4.
fout=open('File2.txt','w')
Was working on version 0.9.6, but is not working in 1.0.4.
The "error" is Read only file system.
It looks like restrictions in the (new 1.0.4) file system library. I post a mail to the editor, but no answer at this time.
For testing, try to write absolute path to your files pointing, for example, to sdcard (/sdcard/out.txt).
I had problems on this versions (>=1.0.4) because launch process of script changes and execution directory is not the same as script directory.
I had to change my scripts to point to absolute paths.
It was tested with qpython developer.
Check this link:
https://github.com/qpython-android/qpython.org/issues/48
You can also try as simple as:
fob=open('File1.txt','r')
fob.read()
Just if the script is in the same folder of the file.
You can change the current working directory to path with script before read file:
import os
os.chdir(os.path.dirname(os.path.abspath(__file__)))

Corona SDK: system.pathForFile returns nil

This code works in the simulator but not on my Android device:
local path = system.pathForFile("chinese_rules.db")
print("PATH:: " .. tostring( path ) )
When I run this code on my Galaxy S4 path returns nil.
My first thought was that it was some typo (case sensitivity) but I can't find any typo:
http://i59.tinypic.com/wlpu14.png
I can't find any reason why it should receive nil. This causes a problem as I can't load my database.
I have also tried this with the same result:
local path = system.pathForFile("chinese_rules.db", system.ResourceDirectory)
I have been able to load a path and load databases like this before.
Corona Build: 2013.2100 (2013.12.7)
Further reading the documentation I don't see that .db is a restricted file type:
Corona allows direct loading of images and audio files using the
appropriate APIs, but it has limited access to resource files on
Android using the file I/O APIs. Specifically, the following types can
not be read from the resources directory: .html, .htm., .3gp, .m4v,
.mp4,.png, .jpg, and .ttf.
http://docs.coronalabs.com/api/library/system/pathForFile.html
I found out the reason for the problem:
We are two that are working on this project and he had setup to use expansion files so two files was created (the main APK and the OBB expansion file) which I didn't notice and I only loaded the main APK file and I guess the database is in the OBB file. After setting not to use an expansion file the app works.
usesExpansionFile = false

Cocos2d-x Sample HelloCpp not running on Android

I have a problem with the included sample HelloCpp in cocos2d-2.0-x-2.0.4.
My environment:
Mac OSX 10.8.2
cocos2d-2.0-x-2.0.4
android-ndk-r8
The proj.ios of the sample is running fine in the xcode emulator but i have problems get the proj.android running on my Android HTC One X Device.
I am able to build the apk file with the makefile from raywenderlich and when i unzip the apk it has the assets/ipad folder included and images in it and after the installation of the apk file on the device the app loads and shows the information about frames etc. in the left lower corner of the screen. But then a notification window pops up and tells me that the program is not able to load "assets/ipad/HelloWorld.png"
The error message is thrown in cocos2dx/platform/android/CCFileUtils.ccp line 134.
Is it correct to load a png file with pData = CCFileUtils::getFileDataFromZip(s_strResourcePath.c_str(), fullPath.c_str(), pSize); ?
Because thats the line where the program is running into in cocos2dx/platform/android/CCFileUtils.ccp line 97.
the value of s_strResourcePath is /data/app/org.cocos2dx.hellocpp.apk and fullpath is assets/ipad/HelloWorld.png.
I really hope someone can help me. Or has the same problem at least.
Just check out in which folder is you all resources. In my case its in assets/Resources .. So i will setResourceDirectory as "Resources" so the path will be assets/Resources ...whereas i guess in ur case its ipad
so set it ipad
Add this lines in AppDelegate.cpp->applicationDidFinishLaunching() function. If it's already there then just change it for the android
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID )
pFileUtil->setResourceDirectory("ipad");
#endif
Try if this works
Try to add your images in "HelloCpp/Resources". Maybe you're adding image files in "HelloCpp/proj.android/assets/".
Try this:
"HelloCpp/Resources/iphone/HelloWorld.png"
"HelloCpp/Resources/ipad/HelloWorld.png"
"HelloCpp/Resources/ipadhd/HelloWorld.png"
Instead of this:
"HelloCpp/proj.android/assets/iphone/HelloWorld.png"
"HelloCpp/proj.android/assets/ipad/HelloWorld.png"
"HelloCpp/proj.android/assets/ipadhd/HelloWorld.png"

Categories

Resources