Loading binary data to project from the custom resource (SOLVED)

Is there any API can load a db(sqlite3) under the custom resource?

image

As far as I know, IO releated API only can work with the path returned by sys.get_save_file.
The sys.load_resource return the loaded data as a string might be only suitable for non binary data. Even I write the string back to a file in the the writeable path, it’s still incorrect when open it again.

The io open can work when start from the editor using relative path. But this is not working in the bundled application.

sys.load_resource loads a custom resource. Custom resources are packaged inside the game’s internal archive files. These archive files are read only. The returned data is of type string, but it is indeed a binary blob.

For bundle_resources, the files aren’t packaged inside the game’s archive files. They are located inside the bundle though, so you can use regular io operations to access that data.

4 Likes

Thanks a lot.

1 Like