I have created one file *txt and handle it on Defold. I build and debug on win32, it works normally. But when I export to HTML5 application then my app not work. And the log error “Failed to load resource: the server responded with a status of 404 (Not Found)”. Who can help me with this issue? Thanks all.
How? What do you mean by handle it?
If you load it using for instance io.open() and read() then yes, that will most likely work on windows if the .txt file is located next to the engine. But on HTML5 the file is not present. It’s still on your hard drive where the browser isn’t able to load it.
If you wish to bundle additional files then I recommend that you use the Custom Resources setting in game.project and sys.load_resource().
Hi, thanks for your answer.
I use io.open () and read () it. The .txt file is located next to the tool and works normally on win32.
So, how to use custom game settings in the game.project and sys.load_resource (). If you have an example of this, then that’s a great thing.
Here’s the docs:
Custom Resources: https://www.defold.com/manuals/project-settings/#_project
sys.load_resource() incl. example: https://www.defold.com/ref/sys/#sys.load_resource:filename
Thanks so much
I think you need to write the full path.
Yes, exactly. Full path like in the example.
Thanks so much. I loaded it success
@britzl I’m writing HTML5 app can read a file “Replay.txt” and display it.
If I use sys:load_resource when build HTML5, this file does not appear in folder, does it has zipped somewhere?
Do you have any solution for this?
Resources that are included as Custom Resources will be included in the engine game archive (one of the game.arcd files in the archive folder).
Thank @britzl, Is there anyway to read a file “a.txt” near index.html or anywhere possible?
I’m in a dead-end.