There are a couple of ways to do it and I’m not sure the best way… you can make a native extension to use built in osx functions to get it
std::string([NSBundle mainBundle].executablePath.UTF8String)
https://developer.apple.com/documentation/foundation/nsbundle/1409078-executablepath
https://developer.apple.com/documentation/foundation/bundle/1409078-executablepath
Would return full path to the engine exectuable I think.
You can also do it based on PID.
I don’t have a Mac handy at the moment to test.
Keep in mind it’s non-trivial to get access to the files Defold packs into the game’s resource files. If you add the files to the .app file it’s no problem.
It would probably be useful if someone made a “where am I” native extension for the various platforms.