[SOLVED] Bundle resources no longer works?

Does bundle resource not longer works? Tried to configure project settings.

Game project file:

[project]
title = Empty Project
bundle_resources = /res

Folder Structure:

Script used, from docs:

function init(self)
	local path = sys.get_application_path()
	print(path)
	local f = io.open(path .. "/text.txt", "rb")
	local txt, err = f:read("*a")
	if not txt then
		print(err)
		return
	end
	print(txt)
end

  1. Scripts throws error, there is not file like this.
  2. There also image is here with 1mb size, if i bundle project into web build and investigate /archive folder there is no files at this size, they all below 37kb, which means resource bundle not inculded.

Example/MRP:

Empty Project.zip (1.1 MB)

You’ve specified /res but there is no res folder in your project.

1 Like

renamed folder as in bundle resource field:

/common

tried to bundle it to my current platform (linux) and run it.

ERROR:SCRIPT: main/main.script:5: attempt to index local ‘f’ (a nil value)stack traceback:main/main.script:5: in function <main/main.script:1>

tried to investigate hmtl build files, there is no any file size over 1mb, which means bundle not unlcuded.

Can you share a test project here where we can reproduce the issue?

original

https://forum.defold.com/uploads/short-url/mf5hpL4ZdU0JCFfzaGzxQFsd5Jd.zip

renamed

Empty Project.zip (5.8 MB)

The platform names or common must be subfolders of the bundled resource folder. So you must create a folder res (or another name), and then put the folder common into that (or platform names). And use res as the bundle resource folder in game.project.

For example, if you use:

res/common/a.txt

then a.txt will be bundled on all platforms.

When you use

res/win32/a.txt
res/android/b.txt

then a.txt will be bundled on Windows, and b.txt on Android.

When you use other folders or no subfolders like

res/a.txt
res/something/b.txt

then both will be ignored, because they are not platform names.

See the bundle resource manual: Working with files

3 Likes

finally!

now files appeared in bundle:

EmptyProject.wasm     archive      image.jpg   text.txt
EmptyProject_wasm.js  dmloader.js  index.html