caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: skaller <skaller@users.sourceforge.net>
To: Ocaml <caml-list@inria.fr>
Subject: [Caml-list] lstat on windows native
Date: 25 May 2004 17:40:49 +1000	[thread overview]
Message-ID: <1085470849.6065.457.camel@pelican.wigram> (raw)

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


             reply	other threads:[~2004-05-25  7:40 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-05-25  7:40 skaller [this message]
2004-05-25  8:55 ` Olivier Andrieu
2004-05-25  9:41   ` skaller
2004-05-25 15:33     ` David Brown
2004-05-25 10:20 ` Peter Jolly
2004-05-25 21:19 ` sylvain.le-gall
2004-05-26  7:19   ` skaller

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=1085470849.6065.457.camel@pelican.wigram \
    --to=skaller@users.sourceforge.net \
    --cc=caml-list@inria.fr \
    /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).