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 JAA05940; Tue, 25 May 2004 09:40:56 +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 JAA05824 for ; Tue, 25 May 2004 09:40:55 +0200 (MET DST) Received: from smtp1.adl2.internode.on.net (smtp1.adl2.internode.on.net [203.16.214.181]) by concorde.inria.fr (8.12.10/8.12.10) with ESMTP id i4P7eqSH026053 for ; Tue, 25 May 2004 09:40:53 +0200 Received: from [192.168.1.200] (ppp114-11.lns1.syd3.internode.on.net [150.101.114.11]) by smtp1.adl2.internode.on.net (8.12.9/8.12.9) with ESMTP id i4P7enZq091405 for ; Tue, 25 May 2004 17:10:50 +0930 (CST) Subject: [Caml-list] lstat on windows native From: skaller Reply-To: skaller@users.sourceforge.net To: Ocaml Content-Type: text/plain Message-Id: <1085470849.6065.457.camel@pelican.wigram> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.2 (1.2.2-4) Date: 25 May 2004 17:40:49 +1000 Content-Transfer-Encoding: 7bit X-Miltered: at concorde with ID 40B2F884.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; sourceforge:01 implemented:01 3.07:01 32,:01 recursively:01 recursion:01 ..,:01 symlink:01 usr:01 usr:01 subdirectory:01 implemented:01 natively:01 dynamically:01 constants:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Currently, I need to use lstat (as pointed out in previous email) but it isn't implemented on Windows native port according to 3.07 documentation. If I understand correctly this means my program won't compile/link on Win32, which isn't very nice. What I'm trying to do is somewhat problematic: recursively find all the files starting from a given directory. I'm skipping over symbolic links to avoid duplication, infinite recursion with . and .., and because the user can specify a set of "root" directories, and therefore always add (the target of) a skipped symlink to the set. It is also possible to exclude bad directories/files. To fix this problem, I can use plain 'stat' and require the client to specify all exclusions/inclusions, and that will work on Windows and Unix, but it is *extremely ugly* because you'd have to exclude /usr/include/. /usr/include/.. etc for every subdirectory .. I wonder if this function can be implemented for Windows? I'm not sure what it means (I don't understand Windows shortcuts). If a "proper" implementation can't be provided, I wonder if a "cheat" which simply defines it the same as 'stat' would make sense. At least my code would then work without requiring conditional compilation (which Ocaml doesn't support natively). I can detect the cheat by Sys.os_type dynamically and do special (less reliable OS dependent) processing, but of course I can't write: if Sys.os_type = "Win32" then stat else lstat [Felix can actually do that, since the constant folder guarrantees to reduce conditionals over constants in a somewhat vain attempt to reduce the need for preprocessor based conditional compilation] -- John Skaller, mailto:skaller@users.sf.net voice: 061-2-9660-0850, snail: PO BOX 401 Glebe NSW 2037 Australia Checkout the Felix programming language http://felix.sf.net ------------------- 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