Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
XFRX Question
Message
 
À
04/02/2010 11:02:52
Information générale
Forum:
Visual FoxPro
Catégorie:
Produits tierce partie
Titre:
Divers
Thread ID:
01447504
Message ID:
01447682
Vues:
89
I don't like to hard code file name with directories. It limits how you distribute the application.


I started using a find file procedure for stuff like this:
I issue this line of code before running special reports that must be available:
llExists =  Do FindFile in Main with "Reports\My_Special_Report.frx"

if llExists = .t.
* continue
else
* no file have a graceful exit after telling user there is a problem
endif
The FindFile Function looks like this:
**************
Function FindFile
************************
* Finds out if a file exists
* Parameter sent is file name with Relative path preferably
* Returns TRUE if found and FALSE if not found
Parameter tcfile
Dimension lafile[1]
llexists = Adir( lafile, tcfile ) > 0
Return llexists
If you put this code in your main file and issue a test for that file before you run what do you get back, True or False?


You can also do this In the APP file ( not the exe ) put a set step on and see what directory you really are in in debug mode.


Don
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform