lisdir() problem

Post Reply
Marc Vanzegbroeck
Posts: 1102
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium
Contact:

lisdir() problem

Post by Marc Vanzegbroeck »

Hi,

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

Code: Select all

      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
yury
Posts: 56
Joined: Wed May 23, 2007 2:01 pm

Post by yury »

i dont think so...

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

Code: Select all

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
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Marc,

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

Code: Select all

function Main()

      local cValue := GetEnv( "USERPROFILE") 

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

Antonio Linares
www.fivetechsoft.com
Marc Vanzegbroeck
Posts: 1102
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium
Contact:

Post by Marc Vanzegbroeck »

Antonio,

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

Regards,
Marc
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Marc,

Fixed. Simply add this function to your main PRG:

Code: Select all

function lIsDir( cDirName )   // Checks an existing directory

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

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

Code: Select all

function Main() 

      local cValue := GetEnv( "USERPROFILE") 

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

Antonio Linares
www.fivetechsoft.com
Marc Vanzegbroeck
Posts: 1102
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium
Contact:

Post by Marc Vanzegbroeck »

Thanks Antonio,

It's working fine now!!

Regards,
Marc
Davide
Posts: 190
Joined: Tue Mar 14, 2006 1:59 am
Location: Italy

Post by Davide »

Antonio Linares wrote:

Code: Select all

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

Code: Select all

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
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Davide,

Thanks!
regards, saludos

Antonio Linares
www.fivetechsoft.com
Post Reply