Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
ADir and Long Filenames
Message
 
À
16/08/2005 08:55:48
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
Visual FoxPro
Divers
Thread ID:
01041216
Message ID:
01041577
Vues:
30
I agree that adir() and file() work with long filenames, or at least I used to :)

(I am using VFP9 on a Windows XP SP2 machine)

Here is a sample function where I try a number of different "configurations":
oTest = CreateObject("FileProps")
oTest.Testthis(getfile())
Return

Define Class FileProps as Custom
   Function Testthis(cFile)
	Release aFile
	Dimension aFile[1]
	=ADir(afile,"C:\Documents and Settings\paulj\Local Settings\Application Data\CustomersDiff.xml")
	? type('afile[1]')

	Release aFile
	Dimension aFile[1]
	=ADir(afile, cFile)
	? file(cFile)
	? type('afile[1]')

	Release aFile
	Dimension aFile[1]
	=ADir(afile, (cFile))
	? file(cFile)
	? type('afile[1]')

	Release aFile
	Dimension aFile[1]
	=ADir(afile, "&cFile")
	? file(cFile)
	? type('afile[1]')

	Release aFile
	Dimension aFile[1]
	=ADir(afile, '"'+(cFile)+'"')
	? file(cFile)
	? type('afile[1]')

	Release aFile
	Dimension aFile[1]
	=ADir(afile, ('"'+cFile+'"'))
	? file(cFile)
	? type('afile[1]')

	Wait window "Done"
   EndFunc
EndDefine
This code will work as expected "most of the time". When it works, any of the "configurations" yield the correct results. When it doesn't work, none of them do. I'm not quite sure why yet, but sometimes this same code acts as if the file in question does not exist. Sometimes it depends on the folder/file I choose and sometimes I think it matters whether the function is inside a class or not.

If I open the debugger and step through the code:

=adir(aFile, cFile) Yields "Expression cannot be evaluated"

=file(cFile) Yields .F.

Thank you for your help,
Paul
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform