Issue with reading .tres files after exporting project

Godot Version

4.2.2

Question

I’m having some issues with exporting my game (to windows). The exe. seems to not read my resources (.tres) when being exported.

To my knowledge the resources haven’t been modified heavily, like metadata etc.
When I place the folders with the txt and resources in the same folder as the exe., then the txt are being read but not the resources. All the folders and files are being read in the res://.

My proses of exporting the game:
Project → Export → Add, Windows → Embed PCK on, Product name → Export Project

Additional information:

  • I’ve tried to export the PCK seperatly but that also didn’t work.

  • I’ve included the *.tres extention in the resource option filter, yet that also didn’t work.

  • This is how I load the .tres:

func setup_resource():
	var bad_dir_name = "res://icons/hiring/applicant_resources/bad_applicants/"
	var bad_dir = DirAccess.open(bad_dir_name)
	
	
	if bad_dir:
		for file_name in bad_dir.get_files():
			var applicant_res = load(bad_dir_name + "/" + file_name)
			
			if applicant_res is Applicant_data:
				applicant_bad_res_dic[file_name] = applicant_res

Any help would be welcomed, thanks!

Try using .path_join, you seem to be adding an extra / into your filepath, maybe Godot’s exported loader has a tough time with extra slashes

var applicant_res = load(bad_dir_name.path_join(file_name))
1 Like

That doesn’t seem to make a different. But thank you for your help.

I’ve found the solution here https://github.com/godotengine/godot/issues/66014#issuecomment-1501894950

The issue is that my .tres files get the extension .remap added to them.

This is the code that solved the issue:

if file_name.ends_with(".remap"):
	file_name = file_name.trim_suffix(".remap")
1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.