From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by sympa.inria.fr (Postfix) with ESMTPS id 03B3E80024 for ; Mon, 10 Oct 2016 12:26:28 +0200 (CEST) Authentication-Results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=gustave.nimant@free.fr; spf=None smtp.mailfrom=gustave.nimant@free.fr; spf=None smtp.helo=postmaster@smtp6-g21.free.fr Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of gustave.nimant@free.fr) identity=pra; client-ip=212.27.42.6; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="gustave.nimant@free.fr"; x-sender="gustave.nimant@free.fr"; x-conformance=sidf_compatible Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of gustave.nimant@free.fr) identity=mailfrom; client-ip=212.27.42.6; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="gustave.nimant@free.fr"; x-sender="gustave.nimant@free.fr"; x-conformance=sidf_compatible Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@smtp6-g21.free.fr) identity=helo; client-ip=212.27.42.6; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="gustave.nimant@free.fr"; x-sender="postmaster@smtp6-g21.free.fr"; x-conformance=sidf_compatible IronPort-PHdr: =?us-ascii?q?9a23=3AMdnZ1xZQedJGk0vCgOxy/c//LSx+4OfEezUN459i?= =?us-ascii?q?sYplN5qZpcS5bnLW6fgltlLVR4KTs6sC0LuM9fuwEjZZqb+681k6OKRWUBEEjc?= =?us-ascii?q?hE1ycBO+WiTXPBEfjxciYhF95DXlI2t1uyMExSBdqsLwaK+i760zceF13FOBZv?= =?us-ascii?q?IaytQ8iJ3p7xjLD5ocSbSj4LrQL1Wal1IhSyoFeZnegtqqwmFJwMzADUqGBDYe?= =?us-ascii?q?VcyDAgD1uSmxHh+pX4p8Y7oGx48sgs/M9YUKj8Y79wDfkBVGxnYCgJ45jTtBTZ?= =?us-ascii?q?VwqE5TM3VXganwBDS1zd7RzgRJb6sSD9q+ZwwiKyMsj/TLRyUjOnufRFUhjt3Q?= =?us-ascii?q?gaLCIw7myfrM11haRH6EauugdjypDZJoeUMfN4YovTZ94XA2RbCJUCHxddC5+x?= =?us-ascii?q?OtNcR9EKOvxV+syk/wMD?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0CrAACya/tXhgYqG9RbGQEBAQEBAQEBA?= =?us-ascii?q?QEBBwEBAQEBFQEBAQECAQEBAQgBAQEBglw1AQEBAQF0fKQ2j3GGSx6EcoEQAoI?= =?us-ascii?q?CPBABAQEBAQEBAQEBARIBAQEICwsJGS+CMgQBFQEEghEBAQQjVQEQCwQUCRYLA?= =?us-ascii?q?gIJAwIBAgFFBg0IAogxAR60XogwCYQyAQEBBwEBAQEkhj2EVYdLgj4dBY46i0V?= =?us-ascii?q?egQeOGIlphgtJiD+Db4N/NV6DCIFgcIYOgUEBAQE?= X-IPAS-Result: =?us-ascii?q?A0CrAACya/tXhgYqG9RbGQEBAQEBAQEBAQEBBwEBAQEBFQE?= =?us-ascii?q?BAQECAQEBAQgBAQEBglw1AQEBAQF0fKQ2j3GGSx6EcoEQAoICPBABAQEBAQEBA?= =?us-ascii?q?QEBARIBAQEICwsJGS+CMgQBFQEEghEBAQQjVQEQCwQUCRYLAgIJAwIBAgFFBg0?= =?us-ascii?q?IAogxAR60XogwCYQyAQEBBwEBAQEkhj2EVYdLgj4dBY46i0VegQeOGIlphgtJi?= =?us-ascii?q?D+Db4N/NV6DCIFgcIYOgUEBAQE?= X-IronPort-AV: E=Sophos;i="5.31,324,1473112800"; d="scan'208,217";a="196224731" Received: from smtp6-g21.free.fr ([212.27.42.6]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Oct 2016 12:26:27 +0200 Received: from [192.168.0.12] (unknown [88.191.137.54]) by smtp6-g21.free.fr (Postfix) with ESMTP id A6CAD7801BC; Mon, 10 Oct 2016 12:26:26 +0200 (CEST) To: Pierrick Couderc References: <57F50A2E.5020900@free.fr> <57FB559A.1070302@free.fr> Cc: "caml-list@inria.fr" From: Gustave Nimant Message-ID: <57FB6CD2.2050002@free.fr> Date: Mon, 10 Oct 2016 12:26:26 +0200 User-Agent: Mozilla/5.0 (X11; Linux i686; rv:38.0) Gecko/20100101 Icedove/38.5.0 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/alternative; boundary="------------010104070204040200000000" Subject: Re: [Caml-list] How to get the path of Filename.current_dir_name This is a multi-part message in MIME format. --------------010104070204040200000000 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit 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 > > > 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 > Thank you very much, now I understand. Best Gustave --------------010104070204040200000000 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit
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

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


Thank you very much, now I understand.
Best
Gustave
--------------010104070204040200000000--