From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id SAA08335; Thu, 24 Oct 2002 18:07:31 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id SAA08728 for ; Thu, 24 Oct 2002 18:07:30 +0200 (MET DST) Received: from cantina.students.cs.unibo.it (cantina.students.cs.unibo.it [130.136.3.110]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id g9OG7T517169 for ; Thu, 24 Oct 2002 18:07:29 +0200 (MET DST) Received: from lordsoth.takhisis.org ([130.136.33.14]) (authenticated bits=0) by cantina.students.cs.unibo.it (8.12.4/8.12.4/Debian-2) with ESMTP id g9OG7Q1L014194 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=FAIL) for ; Thu, 24 Oct 2002 18:07:29 +0200 Received: from lordsoth.takhisis.org (lordsoth.takhisis.org [127.0.0.1]) by lordsoth.takhisis.org (8.12.6/8.12.6/Debian-7) with ESMTP id g9OG79kV016830 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO) for ; Thu, 24 Oct 2002 18:07:09 +0200 Received: (from zack@localhost) by lordsoth.takhisis.org (8.12.6/8.12.6/Debian-7) id g9OG78f5016828 for caml-list@inria.fr; Thu, 24 Oct 2002 18:07:08 +0200 Date: Thu, 24 Oct 2002 18:07:08 +0200 From: Stefano Zacchiroli To: Inria Ocaml Mailing List Subject: [Caml-list] [request] look for .ocamlinit also in home dir Message-ID: <20021024160708.GA16806@cs.unibo.it> Mail-Followup-To: Inria Ocaml Mailing List Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="WIyZ46R2i8wDzkSu" Content-Disposition: inline User-Agent: Mutt/1.4i Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk --WIyZ46R2i8wDzkSu Content-Type: text/plain; charset=us-ascii Content-Disposition: inline It would be nice if the ocaml toplevel look for .ocamlinit not only in the current directory but also in the home directory of the user, is it possible to add such a feature? Attched there is a patch for toplevel/toploop.ml that implements it. Cheers. -- Stefano Zacchiroli - undergraduate student of CS @ Univ. Bologna, Italy zack@cs.unibo.it | ICQ# 33538863 | http://www.cs.unibo.it/~zacchiro "I know you believe you understood what you think I said, but I am not sure you realize that what you heard is not what I meant!" -- G.Romney --WIyZ46R2i8wDzkSu Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=patch --- toploop.ml.orig 2002-10-24 17:29:41.000000000 +0200 +++ toploop.ml 2002-10-24 17:38:20.000000000 +0200 @@ -347,7 +347,25 @@ Compile.init_path() let load_ocamlinit ppf = - if Sys.file_exists ".ocamlinit" then ignore(use_silently ppf ".ocamlinit") + let homedir = + try Some (Sys.getenv "HOME") + with Not_found -> None + in + let initfile = + if Sys.file_exists ".ocamlinit" then + Some ".ocamlinit" + else + (match homedir with + | Some d -> + if Sys.file_exists (d ^ "/.ocamlinit") then + Some (d ^ "/.ocamlinit") + else + None + | None -> None) + in + match initfile with + | Some f -> ignore(use_silently ppf f) + | None -> () let set_paths () = (* Add whatever -I options have been specified on the command line, --WIyZ46R2i8wDzkSu-- ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners