__FILE__ returns the name of the module, not the name and absolute path.
Actually, it returns the exact path given to the compiler. For example :$ cd /tmp$ echo 'Printf.printf \"File path: %s\n%!" __FILE__;;' > t.ml
Then compiled and executed:$ ocamlc t.ml && ./a.out> File path: t.ml
$ ocamlc /tmp/t.ml && ./a.out> File path: /tmp/t.ml
$ ocamlc ../tmp/../tmp/t.ml && ./a.out> File path: ../tmp/../tmp/t.ml