Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
What is the best way to set the starting path?
Message
De
17/01/2005 10:27:56
 
 
À
14/01/2005 06:13:15
Aaron K. Y. Chu
Health & Care Co. Ltd.
Hong Kong, Hong Kong
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Versions des environnements
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Network:
Windows XP
Database:
MS SQL Server
Divers
Thread ID:
00977105
Message ID:
00977746
Vues:
26
Setting Home directory... I haven't dig into the reasons, sometimes, it asks where the file or program is...

I have a little function called SetPath() that is called at the begginning of my main program to do this. Here is the code:
*******************************************************************
FUNCTION SetPath()
*******************************************************************
LOCAL lcSys16, lcProgram, lcPath

  *** Grab name of program that called this one.
  lcSys16 = SYS( 16, 1 )
  lcProgram = JUSTFNAME( lcSys16 )
  
  *** Change to the directory that the program is in  
  CD JUSTPATH( lcSys16 )

  *** If we are running the main program directly, then
  *** CD up to the parent directory
  IF JUSTEXT( lcProgram ) = "FXP"
    CD ..
  ENDIF
  
  *** Go ahead and set the path
  IF VERSION(2) # 0
    ***  We are in Development Mode
    ***  Set up Project search path
    lcPath = HOME() + ';' + FULLPATH( CURDIR() ) + [;form;libs;include;menu;data;prog;report;graphics]
  ELSE
    *** We are in Production Mode
    *** Set up application search path
    lcPath = HOME() + ';' + FULLPATH( CURDIR() ) + [;data;report;graphics]
  ENDIF    

  SET PATH TO ( lcPath )

  *** and the classlibs
  SET CLASSLIB TO application, BaseForm, BaseCtrl, stdCustom, DataContainer ADDITIVE
  SET PROCEDURE TO GlobalProcs ADDITIVE 
 
ENDFUNC
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform