Louis Granboulan on Tue, 2 Apr 2002 17:25:19 +0200

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: Problems with pari compiled in MSVC under Windows

Bill Allombert wrote:
> By any chance, do you know a portable way to know if a file is a
> directory or not ? We only use opendir for this purpose.
> (On Solaris you can open() and read() directory without getting errors.)

According to POSIX, it is the stat() function that is the dedicated
technique to tell if a file is a directory.

However, it has some bugs in MSVC under Windows NT, which are the
reason why XEmacs does it another way... see "nt.c" in XEmacs'
distribution which writes an alternate definition of "stat",
based on Windows API.

I don't know of a simple and portable way to do the test, but you
should make the hypothesis that your OS is POSIX compliant, and
add specific tricks to handle bugs in certain environments.