FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour lisdir() problem
Posts: 1195
Joined: Mon Oct 17, 2005 05:41 AM
lisdir() problem
Posted: Tue Aug 14, 2007 06:32 PM
Hi,

If I call this lisdir() returns FALSE, even when I use lfn2sfn.


      local cValue :=   GetEnv( "USERPROFILE")
       msginfo(lfn2sfn(cValue+'\Local Settings\Application Data'),cValue+'\Local Settings\Application Data')
      msginfo(lisdir(lfn2sfn(upper(cValue+'\Local Settings\Application Data'))))
      msginfo(lisdir(upper(cValue+'\Local Settings\Application Data')))


Is there an error in lisdir()?

Thanks,
Marc
Regards,

Marc



FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
Posts: 56
Joined: Wed May 23, 2007 02:01 PM
lisdir() problem
Posted: Tue Aug 14, 2007 08:25 PM
i dont think so...

here in my testes both returns .T. ( directory exists !!! )

local cValue := GetEnv( "USERPROFILE") 
local cDirec := '\Configurações locais\Application Data'

msginfo(lIsDir(lfn2sfn(upper(cValue+cDirec)))) 
msginfo(lIsDir(cValue+cDirec))


regards
Yury Marcelino Al
yury030575@yahoo.com.br
vimansca@vimansca.com.br
Leme / SP - Brasil
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
lisdir() problem
Posted: Wed Aug 15, 2007 07:10 AM
Marc,

lIsDir() is not working with hidden directories. Try this sample:
function Main()

      local cValue := GetEnv( "USERPROFILE") 

      msginfo( cValue ) 
      msginfo( lIsDir( cValue + "\Documents" ) )
      
return nil
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1195
Joined: Mon Oct 17, 2005 05:41 AM
lisdir() problem
Posted: Wed Aug 15, 2007 10:05 AM

Antonio,

That seems to be the problem.
In FW1.9.5 it was working :(

Regards,
Marc

Regards,

Marc



FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
lisdir() problem
Posted: Wed Aug 15, 2007 10:39 AM
Marc,

Fixed. Simply add this function to your main PRG:
function lIsDir( cDirName )   // Checks an existing directory

   local aResult := Directory( cDirName, "DHS" )

return Len( aResult ) == 1 .and. "D" $ aResult[ 1 ][ 5 ]

sample:
function Main() 

      local cValue := GetEnv( "USERPROFILE") 

      msginfo( cValue ) 
      msginfo( lIsDir( cValue + "\Application Data" ) ) 
      
return nil
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1195
Joined: Mon Oct 17, 2005 05:41 AM
lisdir() problem
Posted: Wed Aug 15, 2007 10:53 AM

Thanks Antonio,

It's working fine now!!

Regards,
Marc

Regards,

Marc



FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
Posts: 190
Joined: Tue Mar 14, 2006 01:59 AM
lisdir() problem
Posted: Mon Sep 03, 2007 08:25 AM
Antonio Linares wrote:
function lIsDir( cDirName )   // Checks an existing directory

   local aResult := Directory( cDirName, "DHS" )

return Len( aResult ) == 1 .and. "D" $ aResult[ 1 ][ 5 ]



a trailing \ in cDirName makes DIRECTORY returning the CONTENT of cDirName

function lIsDir( cDirName )   // Checks an existing directory
Local aResult
  If Right(cDirName,1)="" ; cDirName:=Left(cDirName,Len(cDirName)-1) ; Endif
  aResult := Directory( cDirName, "DHS" )
Return Len( aResult ) == 1 .and. "D" $ aResult[ 1 ][ 5 ]


FWH 7.07 - xH 0.99.71

Hi,
Davide
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
lisdir() problem
Posted: Mon Sep 03, 2007 05:14 PM

Davide,

Thanks!

regards, saludos

Antonio Linares
www.fivetechsoft.com

Continue the discussion