Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
File()
Message
De
29/12/2003 10:38:25
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Re: File()
Divers
Thread ID:
00862385
Message ID:
00862505
Vues:
12
>LOCAL cEmployeesFolder , xFile
>
>cEmployeesFolder = Addbs(Addbs(oApp.cEmployeeImagesFolder) + "_" + Transform(employees.Id))
>If Not Directory(cEmployeesFolder)
> Md (cEmployeesFolder)
>Endif
>
>xFile = cEmployeesFolder + "300x350.jpg"
>
>*-- For a file that does not exist this next test will fail
>*-- That is to say that the block is not executed
>If Not File(xFile)
> *-- This next line fails to execute when the var xFile does not exist
> xFile = Addbs(oApp.cEmployeeImagesFolder) + "camera.jpg"
>Endif
>
>BUT the watch window reports
> File(xFile) is .F.
> NOT File(xFile) is .T.
>
>
>Why would this happen ?

Greg,
I would use it as :
If file(m.xFile) && Thinking there might be a field named xFile

However I don't trust File() and use my own IsFile() function :
	Procedure IsFile
	Lparameters tcPath, tcFile
	Local arrFiles[1]
	Local lcFullPath
	tcPath = Iif(Empty(m.tcPath), Sys(5)+Curdir(),m.tcPath)
	lcFullPath = Iif( Empty(tcFile), m.tcPath, Addbs(m.tcPath)+m.tcFile )
	Return ( Adir(arrFiles,m.lcFullPath) = 1 )
Endproc
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform