Directory() problem with 7.05
Directory() problem with 7.05
Hi,
in our tests with FWH 7.05 Directory( cDirName, "D" ) returns not only directory names but all filenames in this dir. Therefore
function lIsDir( cDirName )
return Len( Directory( cDirName, "D" ) ) == 1
Returns always .f. with 7.05
Somebody with the same problem here?
Thanks,
Taavi
in our tests with FWH 7.05 Directory( cDirName, "D" ) returns not only directory names but all filenames in this dir. Therefore
function lIsDir( cDirName )
return Len( Directory( cDirName, "D" ) ) == 1
Returns always .f. with 7.05
Somebody with the same problem here?
Thanks,
Taavi
- Enrico Maria Giordano
- Posts: 7355
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Contact:
Re: Directory() problem with 7.05
That's the normal DIRECTORY() behavior. If you want to filter out the files you have _ the array for "D" attribute (F_ATTR).
Please consult Clipper/Harbour/xHarbour docs.
EMG
Please consult Clipper/Harbour/xHarbour docs.
EMG
- Enrico Maria Giordano
- Posts: 7355
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Contact:
- Enrico Maria Giordano
- Posts: 7355
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Contact:
It has been changed in the last FWH version. This is from the previous one:
EMG
Code: Select all
function lIsDir( cNewDir ) // Checks an existing directory
local cDir := CurDrive() + ":\" + CurDir()
local lIsDir := lChDir( cNewDir )
if lIsDir
lChDir( cDir )
endif
return lIsDir
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
- Enrico Maria Giordano
- Posts: 7355
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Contact:
Yes, but it returns .T. even if a file is specified:
EMG
Code: Select all
#include "Fivewin.ch"
FUNCTION MAIN()
? LISDIR( "c:\windows\regedit.exe" )
RETURN NIL
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
This seems to be the right code:
Code: Select all
function lIsDir( cDirName )
local aResult := Directory( cDirName, "D" )
return Len( aResult ) == 1 .and. aResult[ 1 ][ 5 ] == "D"
- Enrico Maria Giordano
- Posts: 7355
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Contact:
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
- Enrico Maria Giordano
- Posts: 7355
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Contact:
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact: