10-11-2017 15:00
10-11-2017 15:00
I'm trying to read some binary data. I've added a file called "level_data.bin" to the resources folder but I can't open it for reading.
import * as fs from "fs";
let file = fs.openSync("../resources/level_data.bin", "r");
I've tried it with / and \ and no path at all, thinking it might automatically look in the resources folder. I've also tried the file in the app folder (so there's no relative path), but it just can't open it.
Answered! Go to the Best Answer.
10-13-2017 12:28
10-13-2017 12:28
Hey Allan!
Can you try: /mnt/assets/resources/
Let me know how you get on!
10-12-2017 12:15
10-12-2017 12:15
Are you certain the file is being copied to the app?
You can download the packaged app (option on the top toolbar inside Studio) and unpack it to see if the file is indeed being packed or not. I'm not certain of how they have rollup configured, so you might have to figure out a clever hack for getting it bundled if not. (Just a hunch)
10-12-2017 12:20
10-12-2017 12:20
Good point! I will check that and see when I get back on my computer.
10-13-2017 02:05
10-13-2017 02:05
I've checked the package and the file is definitely there, and definitely in the resources folder.
10-13-2017 12:28
10-13-2017 12:28
Hey Allan!
Can you try: /mnt/assets/resources/
Let me know how you get on!
10-13-2017 12:51
10-13-2017 12:51
It got past the load, now to figure out how to actually access the data!
Thanks.