> > __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 2016-10-10 10:47 GMT+02:00 Gustave Nimant : > On 05/10/2016 16:34, Pierrick Couderc wrote: > > > If I understood correctly, it is more about the directory of the module at > compile time. > > the absolute path of the module at compile time. > > One (hackish) way to do it is with the value __FILE__ in Pervasives (see > http://caml.inria.fr/pub/docs/manual-ocaml/libref/ > Pervasives.html#6_Debugging for some compile time constant used for > debugging). > It simply returns the path of the .ml given to the compiler, not an > absolute path (except if you called the compiler on an absolute path, of > course). > > __FILE__ returns the name of the module, not the name and absolute path. > I do not understand what do you mean by "except if you called the compiler > on an absolute path, of course" > could you please give me more details about calling the compiler on an > absolute path ? > > Thanks > Gustave >