How can I get the working directory? (SOLVED)

I’d like to bundle a file with a game and run it alongside.

To do that, I believe I need the working directory of the game files in order to find the bundled file.

Can I run this file without needing the directory, or do you have a solution to get the directory?

File operations will always start from the current directory, ie where the engine is running from. This means that if you on desktop do an io.open("foo", "r") call the system will try to open a file named foo, located in the same folder as the engine.

If you want to do more with folders and folder hierarchies then look into the Lua File System extension in our Asset Portal.

2 Likes

Thanks!

To bundle resources either use custom resources (they’re part of the compressed game archive), or use ‘bundle_resources’: