Reading and writing text files

I haven’t been able to find any sample code, tutorial, or docs which explain how to use the FileSystem in Heaps.

The Resources page tells me that I need to init the local fs via “hxd.Res.initLocal();”, but inserting that code into my init() function generates a “no such file or directory” error (despite that I’m not yet asking to load any files!).

I can access sys.FileSystem but this doesn’t seem to implement FileSystem (ie dir() is missing). sys.FileSystem.readDirectory() is giving me errors no matter how I format the path.

Anyway, if anyone has any pointers or tips on how to read/write local text files, please let me know! I just want to get a list of file names, read them as bytes, and write new files as bytes. I know this shouldn’t be very complex, and I’ve done this before in several other languages without problem, but those languages all provided docs which had working sample code that demonstrated exactly how to correctly use the file system objects.

I’m really enjoying programming with Heaps but the lack of docs is definitely somewhat frustrating. :confused: