txt file assets

Using build 202 right now. How can I, if possible, have many text files available in a directory, so I can call readText(). Wherever they go, what would be the asset key to enter as the argument to the readtext() call? Thanks!

This relates to my post about svg files. For now, I’ve just renamed the svg file extensions to txt and I’ll parse the info I want from those files myself…if I can access them.

Okay, seems I figured it out, but the issue is the number of files - the code editor freezes when it (probably) is indexing all the files (2000+ 2-4kb txt files) in the directory. Or, if I do get it to run, then it crashes before printing the contents of the file.

If I just try to read a single file, without being co-located with a bunch of other files, then readText(asset.documents.myFile) does the trick…I’ll just have to figure how to have more files available for reading, or store the data I need differently.

Hmm I didn’t test the case for 2000 files, will do this and see how it performs

A little thinking got me what I need: http.request for each svg file (all sitting in a github repo), parse out only the path info that I need, save it in a table, and then save those to project data (key: kanji code, value: json encoded path table). Voilà: I have all the data I need in a ~6mb project data file! Just read that file going forward.

@brianolive glad you were able to find a workaround. I’ll still try to get the thousands-of-files cases working smoothly but it’s good to know I can release Codea 3.1 without this fix

Yes, I’m happy with this solution, so no worries. Thanks @Simeon .

Performance should be improved a lot in the next build