0 votes

in the code where I ran:

var f = File.new() #This is to read each line from the file
if f.file_exists('res://csv_data.csv'):
    f.open(file, File.READ)
    stored_csv = f.get_as_text()

This is the actual example above. It worked perfectly outside of HTML. Some situation that I needed to convert the program into HTML5. So, I converted it and able to work with websocket but I noticed that file doesn't do anything on html.

Is it supported on HTML5? If so, what do you do to load/read file using html5?

Godot version 3.4
in Engine by (83 points)

1 Answer

0 votes

On the File docs it says

Note: To access project resources once exported, it is recommended to
use ResourceLoader instead of the File API, as some files are
converted to engine-specific formats and their original source files
might not be present in the exported PCK package.

Here's an example of how my code changed to work with HTML5:

enter image description here

by (26 points)
edited by
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.