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 mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by sympa.inria.fr (Postfix) with ESMTPS id D274D7FFE1 for ; Wed, 5 Oct 2016 16:35:13 +0200 (CEST) Authentication-Results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=pierrickcouderc@gmail.com; spf=Pass smtp.mailfrom=pierrickcouderc@gmail.com; spf=None smtp.helo=postmaster@mail-wm0-f42.google.com Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of pierrickcouderc@gmail.com) identity=pra; client-ip=74.125.82.42; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="pierrickcouderc@gmail.com"; x-sender="pierrickcouderc@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail2-smtp-roc.national.inria.fr: domain of pierrickcouderc@gmail.com designates 74.125.82.42 as permitted sender) identity=mailfrom; client-ip=74.125.82.42; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="pierrickcouderc@gmail.com"; x-sender="pierrickcouderc@gmail.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-wm0-f42.google.com) identity=helo; client-ip=74.125.82.42; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="pierrickcouderc@gmail.com"; x-sender="postmaster@mail-wm0-f42.google.com"; x-conformance=sidf_compatible IronPort-PHdr: =?us-ascii?q?9a23=3AODFzPR2cBo8AxKZZsmDT+DRfVm0co7zxezQtwd8Z?= =?us-ascii?q?segSLfad9pjvdHbS+e9qxAeQG96KsbQf06GJ7uigATVGusnR9ihaMdRlbFwst4?= =?us-ascii?q?Y/p0QYGsmLCEn2frbBThcRO4B8bmJj5GyxKkNPGczzNBX4q3y26iMOSF2kbVIm?= =?us-ascii?q?bsy8IIPZjty22uau4NWTJlwQ3HvuV4hvNw27phn9scwfgI0qavpgi0iBnnwdVO?= =?us-ascii?q?1c32JlIRqolBbx/MqqtMps+i5Kuv8lsdVLUajgcr4QQrlRDTBgOGcwsp7Frx7G?= =?us-ascii?q?GDOO62EGU24V2jFPHgTI9hqyCo/wvzHgt+F+0y6HMcDsRpg7XD2j6+FgTxq+23?= =?us-ascii?q?RPDCIw7GyC0p84t6lcuh/04kEmzg=3D=3D?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0AuAwDEDvVXfypSfUpcGwEBAQMBAQEJA?= =?us-ascii?q?QEBFwEBBAEBCgEBgxIBAQEBAXVtDwekKYIqjG5UhD6CCSiCcoF2gRACgWoHOhI?= =?us-ascii?q?BAQEBAQEBAQEBARIBAQkLCwkXMYIyBAEVBYIQAQEBAwESEQQZARsSCwEDAQsGB?= =?us-ascii?q?QsNDR0CAiEBAREBBQEKEgYTEhCIEQEDBgkIDp5EgTI+MotCgWuCXwWDagoZJwM?= =?us-ascii?q?JAVODCQEBAQEBAQEBAQEBAQEBAQEBGAMGEIYshFWCR4ItgleCPR0FhmwMkk01h?= =?us-ascii?q?ieGSoMGgjyNN0iIGIQTgjwTHoERDxYHZ4I8LIF/PDQBhnSBQQEBAQ?= X-IPAS-Result: =?us-ascii?q?A0AuAwDEDvVXfypSfUpcGwEBAQMBAQEJAQEBFwEBBAEBCgE?= =?us-ascii?q?BgxIBAQEBAXVtDwekKYIqjG5UhD6CCSiCcoF2gRACgWoHOhIBAQEBAQEBAQEBA?= =?us-ascii?q?RIBAQkLCwkXMYIyBAEVBYIQAQEBAwESEQQZARsSCwEDAQsGBQsNDR0CAiEBARE?= =?us-ascii?q?BBQEKEgYTEhCIEQEDBgkIDp5EgTI+MotCgWuCXwWDagoZJwMJAVODCQEBAQEBA?= =?us-ascii?q?QEBAQEBAQEBAQEBGAMGEIYshFWCR4ItgleCPR0FhmwMkk01hieGSoMGgjyNN0i?= =?us-ascii?q?IGIQTgjwTHoERDxYHZ4I8LIF/PDQBhnSBQQEBAQ?= X-IronPort-AV: E=Sophos;i="5.31,449,1473112800"; d="scan'208,217";a="239526449" Received: from mail-wm0-f42.google.com ([74.125.82.42]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/AES128-GCM-SHA256; 05 Oct 2016 16:35:12 +0200 Received: by mail-wm0-f42.google.com with SMTP id p138so277655737wmb.1 for ; Wed, 05 Oct 2016 07:35:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=XBlGrcM2kuy2jUFMGnuXLJ0mnQy5aPaA9b6skOD5NYc=; b=BCkN0GMRH4lt0ZfLTAMADzMdk1hEw8itrhfnwoV6w6cY8qYpfsu17pxGpTZHmPbQiw aFqDlfLo8Sh31+V90pJfqGrujUI9Xke6hUrNvTiD8B/4PjA+L8WhfnHGr66cVaamv3Dj De5QTqNkT85qeHjnijGFAB10AtRE2riC7XZcNnb2QLVlOL6wY7TYmLw6LjIIT144UGGW vcpyr6EGxkw1xkHB418R+Xon+BJpgiwG7JhjO0l39U/iJdbO2B0mpnDcPUp1WwcPVXQx Ym2T7rIWxXSkHjaYFka1ZNZw3rlndXmqqGYU5aRzoXrI33AlQ/Ncr2C+R/ATr4pd+wkk GH3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=XBlGrcM2kuy2jUFMGnuXLJ0mnQy5aPaA9b6skOD5NYc=; b=Yt63oUB8OVXusC5DSIi9ozsbiABjpMl3CliOiPAIO94V8ITbspskhMAzGO93azXY+f DrFPCD/LV1fpWqMi3HuhKGWeVHtCJ9Hy2P5MZGb7fgQI03PgHgS6sSJC6tdIJ+D1QWbo W92sSKbxkJSVpdoLAWrprPXgh78IZwP6GdHCMoEitniQk+gW/eWnvWSNE7in7g0Z4EOc oKKnGm1V+WtyoFkzPvSKsa3FF9AdrE7M1UhYNxvJPTZiS9AM4HhbgEWui4LO94yUUZeQ BJ1SmFxhhfHeBIwI92cRwAh8f1dD9GfHUb0zgLiRwAgJ/05AFutWytNVF7D3KFL4pwtg 4Drw== X-Gm-Message-State: AA6/9RnDKtUkU2+k+MqmhEbN0HyyvKqcPPX+kqxBtxFyKf7eoIq9/WKq2QA77vK4ozre5voL2ZthiihSds5ghw== X-Received: by 10.194.184.39 with SMTP id er7mr8052994wjc.159.1475678112305; Wed, 05 Oct 2016 07:35:12 -0700 (PDT) MIME-Version: 1.0 Received: by 10.194.147.4 with HTTP; Wed, 5 Oct 2016 07:34:51 -0700 (PDT) In-Reply-To: References: <57F50A2E.5020900@free.fr> From: Pierrick Couderc Date: Wed, 5 Oct 2016 16:34:51 +0200 Message-ID: To: Gabriel Scherer Cc: Gustave Nimant , "caml-list@inria.fr" Content-Type: multipart/alternative; boundary=047d7ba97a10afd8a9053e1f15dc Subject: Re: [Caml-list] How to get the path of Filename.current_dir_name --047d7ba97a10afd8a9053e1f15dc Content-Type: text/plain; charset=UTF-8 > > You are probably looking for Sys.getcwd : unit -> string If I understood correctly, it is more about the directory 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). I do not think there is any way to get the current directory of an implementation at compile time otherwise. 2016-10-05 16:22 GMT+02:00 Gabriel Scherer : > Filename.current_dir_name is likely to be just ".", it indicates the > (location-agnosti) way to refer to the current directory on your system, to > make it easier to write code that is portable on other operating systems > with different path conventions. > > You are probably looking for > > Sys.getcwd : unit -> string > > which when called returns the current working directory (as the `pwd` > command would do). It may of course change over the time of your program > execution, for example if you called Sys.chdir. There is also > > Sys.executable_name : string > > (or Sys.argv.(0)) which contains the path of the executable, but it may be > a relative path -- it depends on how the program was invoked. > > On Wed, Oct 5, 2016 at 10:11 AM, Gustave Nimant > wrote: > >> Dear list, >> >> I would like to get the path of the current directory where the current >> executed module is implemented. >> Is there any builtin constant ? >> I could not find. >> >> Thanks, >> Gustave >> >> -- >> Caml-list mailing list. Subscription management and archives: >> https://sympa.inria.fr/sympa/arc/caml-list >> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners >> Bug reports: http://caml.inria.fr/bin/caml-bugs >> > > --047d7ba97a10afd8a9053e1f15dc Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
You are = probably looking for=C2=A0
=C2=A0 =C2=A0=C2=A0
=C2=A0 =C2=A0Sys.getcwd : unit -> string
=C2=A0
If I understood correctly, it is more about the dir= ectory of the module at compile time.=C2=A0

One (h= ackish) way to do it is with the value __FILE__ =C2=A0in Pervasives (see=C2= =A0http://caml.inria.fr/pub/docs/manual-ocaml/libref/Pervasi= ves.html#6_Debugging for some compile time constant used for debugging)= .=C2=A0
It simply returns the path of the .ml given to the compil= er, not an absolute path (except if you called the compiler on an absolute = path, of course).=C2=A0

I do not think there is an= y way to get the current directory of an implementation at compile time oth= erwise.

2016-10-05 16:22 GMT+02:00 Gabriel Scherer <gabriel.scherer@gma= il.com>:
<= div>
Filename.current_dir_name is likely to be just ".", it i= ndicates the (location-agnosti) way to refer to the current directory on yo= ur system, to make it easier to write code that is portable on other operat= ing systems with different path conventions.

You are probably = looking for

=C2=A0 =C2=A0 Sys.getcwd : unit -> string

whic= h when called returns the current working directory (as the `pwd` command w= ould do). It may of course change over the time of your program execution, = for example if you called Sys.chdir. There is also

=C2=A0 Sys.execut= able_name : string

(or Sys.argv.(0)) which contains the p= ath of the executable, but it may be a relative path -- it depends on how t= he program was invoked.

On Wed, Oct 5= , 2016 at 10:11 AM, Gustave Nimant <gustave.nimant@free.fr> wrote:
Dear list,

I would like to get the path of the current directory where the current exe= cuted module is implemented.
Is there any builtin constant ?
I could not find.

Thanks,
Gustave

--
Caml-list mailing list.=C2=A0 Subscription management and archives:
https://sympa.inria.fr/sympa/arc/caml-list
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


--047d7ba97a10afd8a9053e1f15dc--