I am developing a server with Ocaml/Dream. The server can be installed with Opam and called from anywhere in the disk. For the server icon, I use :
Dream.get (favicon_path)
(fun request ->
Dream.from_filesystem "assets" "myiconfile.ico" request);
The problem with this code is that is works (the icon is displayed) only if I run my server from the root folder of my repository (I have indeed, asserts/myiconfile.ico in my repo).
I would like it to work even when the user launches the server from elsewhere by looking for the icon file in the "package" installed with opam.
It seems that Ocaml doesn't allow to "calculate" paths at compilation time but only at run time. Is that correct? and how to work it around? How do Dream developers typically do to use files embedded with their code (like in Java for instance)?