Page 1 of 1
lisdir() problem
Posted: Tue Aug 14, 2007 6:32 pm
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
Posted: Tue Aug 14, 2007 8:25 pm
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
Posted: Wed Aug 15, 2007 7:10 am
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
Posted: Wed Aug 15, 2007 10:05 am
by Marc Vanzegbroeck
Antonio,
That seems to be the problem.
In FW1.9.5 it was working
Regards,
Marc
Posted: Wed Aug 15, 2007 10:39 am
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
Posted: Wed Aug 15, 2007 10:53 am
by Marc Vanzegbroeck
Thanks Antonio,
It's working fine now!!
Regards,
Marc
Posted: Mon Sep 03, 2007 8:25 am
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
Posted: Mon Sep 03, 2007 5:14 pm
by Antonio Linares
Davide,
Thanks!