lisdir() problem

lisdir() problem

Postby Marc Vanzegbroeck » Tue Aug 14, 2007 6:32 pm

Hi,

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


Code: Select all  Expand view  RUN
      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
Marc Vanzegbroeck
 
Posts: 1159
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium

Postby yury » Tue Aug 14, 2007 8:25 pm

i dont think so...

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

Code: Select all  Expand view  RUN
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
yury
 
Posts: 56
Joined: Wed May 23, 2007 2:01 pm

Postby Antonio Linares » Wed Aug 15, 2007 7:10 am

Marc,

lIsDir() is not working with hidden directories. Try this sample:
Code: Select all  Expand view  RUN
function Main()

      local cValue := GetEnv( "USERPROFILE")

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

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42122
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Marc Vanzegbroeck » Wed Aug 15, 2007 10:05 am

Antonio,

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

Regards,
Marc
Marc Vanzegbroeck
 
Posts: 1159
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium

Postby Antonio Linares » Wed Aug 15, 2007 10:39 am

Marc,

Fixed. Simply add this function to your main PRG:
Code: Select all  Expand view  RUN
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  Expand view  RUN
function Main()

      local cValue := GetEnv( "USERPROFILE")

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

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42122
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Marc Vanzegbroeck » Wed Aug 15, 2007 10:53 am

Thanks Antonio,

It's working fine now!!

Regards,
Marc
Marc Vanzegbroeck
 
Posts: 1159
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium

Postby Davide » Mon Sep 03, 2007 8:25 am

Antonio Linares wrote:
Code: Select all  Expand view  RUN
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  Expand view  RUN
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
Davide
 
Posts: 190
Joined: Tue Mar 14, 2006 1:59 am
Location: Italy

Postby Antonio Linares » Mon Sep 03, 2007 5:14 pm

Davide,

Thanks!
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42122
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 56 guests