[SOLVED] Bundled resources

Hi!

I am trying to include some license files with Windows bundles. I understand that these files are supposed to be included as is on the file system. However, when I issue a build command, I see no trace of the files in the bundle folder. What I did is simply add my folder “/assets/common” in the “Bundle Resources” setting in game.project. Is there another setting I must activate? Perhaps I removed something in my manifest that prevents the bundled resources from being included?

Thanks!

Bundle resource are loaded inside the application bundle in the archive, and loaded using sys.load_resource(). Your are probably looking for the custom resources option?

2 Likes

Hi Björn!

I am already using custom resources and the sys.load_resource function for this. I load the dictionary via this technique and it works perfectly fine. However, the documentation states that we also have bundled resources that - as I understand it - are files copied as is in the bundle and loaded from the file system using io.* The doc even says that to obtain the path to these files, one can use sys.get_application_path() function.

I do not want to load the files. I simply want to bundle my license files using this technique. For sure I can simply add the files to the bundle once it is built but I find it would be better for me to copy the files to “assets/common” and have any bundle (except HTML5 per the documentation) include them when I issue the bundle command. This way I would not forget them.

But if I wanted to actually distribute a file and load it this way it wouldn’t work as I expect - or as the documentation suggests.

No, Custom Resources are the one that are bundled in the archive and loaded with sys.load_resource(). They asked for files that should be in the bundle folder, which should be Bundle Resources.

In the folder “/assets/common”, is there a folder structure of different platforms, or is it supposed to be just the “common” platform? In the second case, you should just put “assets” in the field Bundle Resources, not “/assets/common”.

I would think you have to put common since the example in the documentation is clear: the folder structure has a common folder for all platforms, a win32 for windows, etc…

EDIT: I get it… I would have a folder common but only specify assets and the system would pick up whatever is there?

1 Like

Yes, you should have a common folder in the root of your bundled folder. But you should put the root of that bundled folder in the “Bundle Resource” field, not include the platform. If you have the folders “assets/common”, “assets/win32”, “assets/android”, and your “Bundle Resource” field is “assets”, then it will look in the folder “assets” for either a folder “common”, or one fitting the bundled platform. So don’t change your folder sturcture, just change your field “Bundle Resource” in game.project to just “assets”, and not “/assets/common”, which would look for a folder “/assets/common/common” or “/assets/common/win32”.

2 Likes

Ok I will try that. Thanks @Halfstar !!!

Ok it worked!

1 Like

When using Defold project settings, I think it’s better to use a separate folder such as /res rather than the whole /assets folder

2 Likes

Yes. You are correct. I will update my project as you suggestion makes a lot of sense. Thanks!

Ah, yes, I confused the two! Sorry about that!

Custom resources = Bundled inside the game archive
Bundle resources = Bundled next to the game archive (requires a specific folder structure to work)