You can use sys.get_application_path() to get the path to the application, but it requires special considerations per platform since sometimes it points you to the directory where the exe is and where your mygraphics.png will also be, and sometimes it points you to an .app folder which you must then go into like in macOS. iOS is flat I think.
For game.project you want something like
[project]
...
bundle_resources = /bundled
sys.load_resource is the wrong thing to use for bundle_resources. If you want to load something with sys.load_resource their folders should be listed under custom_resources, which are included packed inside of the game files. These files are relative to the root of your project. So if you have “/json/myfile.json” that’s the path you would use for loading, and you would want to include the json folder as a custom resource.
Usually you want to use budled resources when you want something outside of the game pack for various reasons such as reducing memory footprint like with FMOD sound banks, or swapable portal splash images.
so what works with bundle_resources to load from disk? and how does that work?
To be clear, I want to load one time backgrounds for a scene into memory, use them, discard, and load them from whatever is bundled with the app, or HTML5 package. I had io.open working locally in the editor but not in the HTML5 bundle so I figured it’s a pathing / packaging issue and I’m still struggling to match the combination of approach / file paths / packaging bundles to get it to sync up. I tried Mac package and it fails too. It seems once I understand the specifics of addressing objects in the various directory structures I can fix it all.
The best and easiest solution to work with that is guaranteed to work the same on all platforms is to use sys.load_resource() and the Custom Resources field in game.project. If you use Custom Resources the files will be included in the application archive which means that you can’t read them using io.* operations. On the other hand you don’t have to care about various quirks of the different file systems. sys.load_resource() is guaranteed to work the same way on all platforms.