caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Gustave Nimant <gustave.nimant@free.fr>
To: Pierrick Couderc <pierrickcouderc@gmail.com>
Cc: "caml-list@inria.fr" <caml-list@inria.fr>
Subject: Re: [Caml-list] How to get the path of Filename.current_dir_name
Date: Mon, 10 Oct 2016 12:26:26 +0200	[thread overview]
Message-ID: <57FB6CD2.2050002@free.fr> (raw)
In-Reply-To: <CA+gYG2vrea94tCP1ijAusN8JyMvmO6gmR5wPvPnf58DE++EZAw@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 676 bytes --]

On 10/10/2016 11:01, Pierrick Couderc wrote:
>
>      __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 
> <http://t.ml>
>
> Then compiled and executed:
>   $ ocamlc t.ml <http://t.ml> && ./a.out
>   > File path: t.ml <http://t.ml>
>
>   $ ocamlc /tmp/t.ml <http://t.ml> && ./a.out
>   > File path: /tmp/t.ml <http://t.ml>
>
>   $ ocamlc ../tmp/../tmp/t.ml <http://t.ml> && ./a.out
>   > File path: ../tmp/../tmp/t.ml <http://t.ml>
>

Thank you very much, now I understand.
Best
Gustave

[-- Attachment #2: Type: text/html, Size: 1965 bytes --]

  reply	other threads:[~2016-10-10 10:26 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-27 15:04 [Caml-list] [ANN] BAP 1.0.0 Ivan Gotovchits
2016-10-04 13:30 ` Anil Madhavapeddy
2016-10-05 14:11 ` [Caml-list] How to get the path of Filename.current_dir_name Gustave Nimant
2016-10-05 14:22   ` Gabriel Scherer
2016-10-05 14:34     ` Pierrick Couderc
2016-10-10  8:47       ` Gustave Nimant
2016-10-10  9:01         ` Pierrick Couderc
2016-10-10 10:26           ` Gustave Nimant [this message]
2016-10-05 14:35   ` Daniel Bünzli

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=57FB6CD2.2050002@free.fr \
    --to=gustave.nimant@free.fr \
    --cc=caml-list@inria.fr \
    --cc=pierrickcouderc@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).