Equivalent to /proc/self/exe

Does Haiku have any API to get the path to the currently running executable?

There are different techniques depending on how your code works. The “standard” way is to loop using the get_next_image_info() call until you find an image of type B_APP_IMAGE. There are many examples in the HaikuPorts repository if you do a search on that function name.

1 Like

If you are running an application that uses the application kit (BApplication) you can also use this: The Haiku Book: app_info Struct Reference


See the example. be_app is a global pointer to your BApplication object (if you never derived from BApplication, eg. a simple terminal app).