Hi,
Seems to me this rather goes to down to platform behavior,
than being a bug in Harbour code itself. Harbour actually
passes down the file spec to the OS filefind call, unmodified.
Exact behavior for this case is also not described in detail
in the CA-Cl*pper NG.
I know that parameter of of Directory() is passed to system function
unmodified. And the question is a little delicate (not sure is the right
english word to express what I mean), that's why I wanted to say it on
mailing list before changing behavior on SVN.
I guess this behavior of clipper is from DOS int 21h system API, but one
of Harbour's purpose is to mask platform dependent behavior. Perhaps
this case is not an exception also. Norton guide and other documentation
never shows all possible behavior of the functions and we use tests to
be Clipper compatible.
Since directory("c:\path","d") returns an array of 1 element, my friend
used directory("c:\path\","d") to get list of directory for years. He
did it in Clipper, and after that he successfully did it in xHarbour.
I've looked to xHarbour's code, they have code to mask platform
dependent behavior:
if ( pFileName[iNameLen-1] == OS_PATH_DELIMITER ) // '\\'
{
strcat(pFileName,"*.*") ; // 26/01/2004: Clipper compatibility
}
We may try to mask these platform differences in Harbour
code (controlled with some more SETs), but I'd rather suggest
to modify the call to be more platform independent.
I don't thing we need some set, we just need to a few lines like above
of code to mask platform dependent behavior.
(f.e.:
*.* won't return some stuff under Linux, which would be
returned under DOS/Windows)
I've just finished my test on linux. I do not have Harbour under linux,
but I've tried to analyze opendir() system call. opendir("/path/") gives
listing of folder, so, I guess directory("/path/") will also (but it can
depend on our implementation). This made me a stronger feeling we must
hide platform dependent behavior under windows.
So, if DOS and Linux version for directory(".../") gives file list and
the Clipper also, I found it to be enough reason to hide platform
behavior under windows by adding a few lines of code.
BTW, "*" will work on both windows and Linux, but it's not the case,
because in linux we need to pass path only to opendir() function. File
mask filtering is done later by our code.
Probably the same goes for ADIR().
I should look to the docs. I do not know such function :)
Best regards,
Mindaugas
P.S. please, can someone test directory("/path/") under Linux.
_______________________________________________
Harbour mailing list
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour