I’m just starting out with V-play. I’m trying to replicate a simple test I have in Corona to compare to V-Play. The test is loading some words into a searchable object. I realise it’s better to start with a database, but I’m just starting with what I’ve done in Corona (which is loading a large word list from a fie into a table for searching later).
Firstly I’m loading via readFile like so (from the manual) and using a Windows PC I find it’s not needed to specify a url property or wrap the filename with Qt.resolvedUrl. Is it expected?
That is, the following works fine (which I think ought not to work)
var storageData = fileUtils.readFile("files/dictionary.txt")
but if I use
var storageData = fileUtils.readFile(Qt.resolvedUrl("files/dictionary.txt"))
property url dictFile: "files/dictionary.txt" ... var storageData = fileUtils.readFile(dictFile)
these fail (file can’t be loaded).
That’s a bit confusing for me.
Also when I try a test on an Android device, I can’t ever read a file. I guess it’s due to storage location, ie.
For Android it’s apparently here /data/net.vplay.demos.VPlayTests/files/ (on external storage location)
but when I try a simple case, it’s not working. I’ve even tried to manipulate the above, thinking maybe it’s really
/net.vplay.demos.VPlayTests/files/ or /net.vplay.demos.VPlayTests/
Has anyone got a file to load from Android, and if so which folder did you need to put the file into?
I have to say, for me, this approach is rather confusing. In Corona, it’s possible to simply place the data file next to the main.lua and it is packaged within the APK.
Similarly, I find it a bit strange that for Windows, I have to put the data file in C:\Users\<Username>\Documents
when it seems logical to associate that data with the rest of the QML within a subfolder or similar.