The Godot Q&A is currently undergoing maintenance!

Your ability to ask and answer questions is temporarily disabled. You can browse existing threads in read-only mode.

We are working on bringing this community platform back to its full functionality, stay tuned for updates. | Twitter

+1 vote

I am trying to make a simple quiz game (godot v3.2.1 stable) with some jpeg photos located in res://photos/
I have used the following code to get the images to a var called movie_titles (it's a movie quiz!):

func dir_contents(path):
    JavaScript.eval("console.log('reading from path:"+path+"')")
    var dir =
    if == OK:
        var file_name = dir.get_next()
        while file_name != "":
            if dir.current_is_dir():
                #print("Found directory: " + file_name)
                #print("Found file: " + (path+file_name).get_extension())
                if (path+file_name).get_extension() == "jpg":
            file_name = dir.get_next()
        print("An error occurred when trying to access the path.")
        JavaScript.eval("console.log('An error occurred when trying to access the path.')")


My problem is that when I export this to html5 I get that the size of the movie_titles is 0.

I get this both from the built in test webserver and in python3's web server. Is there something I need to do to html5 export?

in Engine by (72 points)

1 Answer

0 votes

Actually this is answered before:

It seems that the jpeg/image files are moved into a special .import folder and the actual forlder has only jpg.import extensions. Looking at the above answer I was able to complete my solution and load dynamically what I wanted.

by (72 points)
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.