I am using the File component to read a text asset file. I have no problem in reading the file with "Call File1.ReadFrom fileName" block. However when I use the "Call File1.AppendToFile text fileName" block, an error "Error 2016 : cannot write asset file at //FileDB.txt". FileDB.txt is my text asset file.
Any suggestions to fix the problem ?
Any suggestions to fix the problem ?
--
All files in the assets folder are read-only and you won't be able to write to that folder.
--
All files in the assets folder are read-only and you won't be able to write to that folder.
according the documentation http://ai2. appinventor.mit.edu/reference/ components/storage.html#File this is possible
you might want to provide a screenshot of your relevant blocks
AppendToFile(text text, text fileName)
SaveFile(text text, text fileName)
I believe the assets folder is-not writable and as result the documentation has to be updated to reflect this.
--
some more testing is required...
meanwhile I think, you only can read a text file from the assets as Hossein said.
If you want to append, you have to save first into the programs private data directory (which is different from the assets directory) and then append there...
--
--
Your example does not write to assets folder. To reference the assets folder you have to prefix with double slashes (//).
--
Hossein is correct, you can't write to assets folder.
If you want to append, you have to save first into the programs private data directory (which is different from the assets directory) and then append there...
screenshot and example project attached.
댓글 없음:
댓글 쓰기