* Ben Wing:
René Kyllingstad wrote:
> (first (file-attributes (first (directory-files "c:/foo" t nil nil
> t))))
>
> => t
>
> so file stat *does* at some level recognize it as a directory.
>
>
you could try (file-attributes "c:/foo/..") but that might not give you
much of use since file-attributes expand-file-name first.
what you really need to do is put a breakpoint on mswindows_stat() just
before calling (directory-files "c:/foo") and see what happens when
".."
comes up.
Right. What happens is:
The incoming name is "c:\foo\..". This remains unchanged until the rootdir
test:
/* Remove trailing directory separator, unless name is the root
directory of a drive or UNC volume in which case ensure there
is a trailing separator. */
len = strlen (name);
rootdir = (path >= name + len - 1
&& (IS_DIRECTORY_SEP (*path) || *path == 0));
this test fails (meaning rootdir is set to 0). This results in "c:\foo\.."
being passed to FindFirstFile() which returns an error code when passed a
rootdir, the error is returned to directory-files, which then in effect
assumes that it is not a directory.
-- René