load() is failing in HTML5 export

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By literalcitrus
:warning: Old Version Published before Godot 3 was released.

I’m using a script to load all the texture files from a directory into a dictionary. The script works fine in the editor and in desktop exports, but for some reason the load() call in the web export is returning null objects.

Here’s the function that gets called in _ready() of my script. I can’t figure out what’s going wrong.

func load_anim_files():
# load files
var dir = Directory.new()
var dir_path = "res://entities/player/animation/powerups/"
if (dir.open(dir_path) == OK):
	dir.list_dir_begin()
	var file_name = dir.get_next()
	while (file_name != ""):
		if (dir.file_exists(file_name)):
			anim_sprites[file_name] = load(dir_path + "/" + file_name)
		file_name = dir.get_next()

I’m using version 2.1.2 stable.


EDIT: Solved the problem. The extra “/” I put into the load() function was causing a weird directory (along the lines of “res://directory/to//thing”). Somehow this was working fine in all other exports, but obviously web is a little less robust with this stuff.