Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

File Paths

Status
Not open for further replies.

FoxStudent

Technical User
Feb 24, 2000
85
GB
How do you ensure that the default location that a visual fox pro application looks for files is where the given's project's directory is, instead of in the Visual Fox Pro directory. Also after the project has been compiled, how do you ensure that it can be placed on any directory on any drive and still work?
 
When you say the &quot;project compiled&quot; I assume you mean built into an EXEcutible.&nbsp;&nbsp;It does not matter what the directory at installation is named as long as you use relative pathing in your code.&nbsp;&nbsp;Typically this directory contains the runtime.dll from your distribution setup (ie Wizard) which foxpro sets as the current directory when your application starts.&nbsp;&nbsp;<br>The project manager keeps track of your your project's home apth even if you move it.&nbsp;&nbsp;Hence, &quot;project has moved, make &lt;your new proj path&gt; the new home directory?&quot; message.&nbsp;&nbsp;Just put your data, forms, etc somewhere in it and reference your them from there.&nbsp;&nbsp;Use SET PATH TO datadir, formsdir, etc or use relative paths such as USE datdir\mytable.&nbsp;&nbsp;<br><br>However, under development the current directory is the directory foxpro.exe started from.&nbsp;&nbsp;Change the defualt path with SET DEFAULT TO &lt;yourprojpath&gt; or if your project is open:<br>* SET LIBRARY TO foxtools.fll ADDIDTIVE&nbsp;&nbsp;&& uncomment if not running v6<br>cProjPath = justpath(application.projects.item(1).name)<br>SET DEFAULT TO (cProjPath)<br>SET PATH TO datafolder, formfolder && ,etc<br><br>John Durbin
 
I never hard code a drive letter into my programs.<br>like&nbsp;&nbsp;use c:\xxx\xxx.dbf<br>I have a table that contains the fields<br>SYSDRV (c,3)<br>SYSDBF (c,50)<br>SYSRPT (c,50)<br>SYSSRC (c,50)<br>etc<br><br>then at the start of the main program I call this program setfcmem<br>After that I do<br>use (fcSysDbf + &quot;CUSTOMER.DBF&quot;)&nbsp;&nbsp;alias Customer in 0 <br>If you do this with all calls to menus, screens, database, reports, classes,&nbsp;&nbsp;etc,<br>you can then move your program from computer to computer and drive to drive at will.<br><br>NOTE : All data in the fields end with the directory symbol \ <br>for example<br>C:\<br>bidsys\<br>bidsys\dbf\<br>etc<br><br>*/***************************************************************************<br>*/Program&nbsp;&nbsp;&nbsp;: FCBIDSYS<br>*/System&nbsp;&nbsp;&nbsp;&nbsp;: Project Bidding System<br>*/Purpose&nbsp;&nbsp;&nbsp;: populate the Fc memvars from the BIDSYS table<br>*/Syntax&nbsp;&nbsp;&nbsp;&nbsp;: do fcbidsys<br>*/Returns&nbsp;&nbsp;&nbsp;: nothing<br>*/Parameter : nothing<br>*/Defaults&nbsp;&nbsp;: nothing<br>*/Requires&nbsp;&nbsp;: 1. database bidsys to be in the default Dir<br>*/&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;: 2.&nbsp;&nbsp;&nbsp;&nbsp;the Fc memvars to be declared public in the calling prg<br>*/Changes&nbsp;&nbsp;&nbsp;: FC* memvars<br>*/Calls&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;: nothing<br>*/Version&nbsp;&nbsp;&nbsp;: 1.0<br>*/Dated&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;: 11/07/97<br>*/Written By: David W. Grewe<br>*/***************************************************************************<br>*& type of prg :<br>*/***************************************************************************<br>*/ Record Of Change<br>*/<br>*/***************************************************************************<br>public PRJTYPE , fcPrjType , fcSysDrv , fcSysDir , fcSysDbf , fcSysRpt , fcSysIcon , fcSysWave , fcSysWall<br>public fcPrintDir , fcTempDir , fcMailer , fcVendor , fcSupDir , fcSupDrv<br>store &quot; &quot; to PRJTYPE , fcPrjType , fcSysDrv , fcSysDir , fcSysDbf , fcSysRpt , fcSysIcon , fcSysWave , fcSysWall<br>store &quot; &quot; to fcPrinjDir , fcTempDir , fcSupDir , fcMailer , fcVendor , fcSupDrv<br>*<br>if !used(&quot;BIDSYS&quot;)<br>&nbsp;&nbsp;use BIDSYS in 0<br>endif<br>if sys(5) != BIDSYS.SYSDRV<br>&nbsp;&nbsp;replace BIDSYS.SYSDRV with sys(5)<br>endif<br>*<br>M.PRJTYPE = alltrim(BIDSYS.PRJTYPE)<br>fcPrjType = alltrim(BIDSYS.PRJTYPE)<br>fcSysDrv&nbsp;&nbsp;= alltrim(BIDSYS.SYSDRV) + &quot;:\&quot;<br>fcSysDir&nbsp;&nbsp;= fcSysDrv + alltrim(BIDSYS.SYSDIR)<br>fcSysDbf&nbsp;&nbsp;= fcSysDrv + alltrim(BIDSYS.SYSDBF)<br>fcSysRpt&nbsp;&nbsp;= fcSysDrv + alltrim(BIDSYS.SYSRPT)<br>fcSysIcon = fcSysDrv + alltrim(BIDSYS.SYSICON)<br>fcSysWave = fcSysDrv + alltrim(BIDSYS.SYSWAVE)<br>fcSysWall = fcSysDrv + alltrim(BIDSYS.SYSWALL)<br>fcPrintDir= fcSysDrv + alltrim(BIDSYS.PRINTDIR)<br>fcSupDrv&nbsp;&nbsp;= alltrim(BIDSYS.SUPPORTDRV) + &quot;:\&quot;<br>fcSupDir&nbsp;&nbsp;= fcSysDrv + alltrim(BIDSYS.SUPPORTDIR)<br>fcMailer&nbsp;&nbsp;= fcSysDrv + alltrim(BIDSYS.SUPPORTDIR) + alltrim(BIDSYS.MAILERS)<br>fcVendor&nbsp;&nbsp;= fcSysDrv + alltrim(BIDSYS.SUPPORTDIR) + alltrim(BIDSYS.VENDORS)<br>fcTempDir = alltrim(BIDSYS.TEMPDIR)<br>on error **<br>md (fcTempDir)<br>md c:\temp<br>on error<br>*<br>lcPath = fcSysDir&nbsp;&nbsp;+ &quot;,&quot; + ;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fcSysDbf&nbsp;&nbsp;+ &quot;,&quot; + ;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fcSysRpt&nbsp;&nbsp;+ &quot;,&quot; + ;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fcSysIcon + &quot;,&quot; + ;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fcSysWave + &quot;,&quot; + ;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fcSysWall + &quot;,&quot; + ;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fcSysDir + &quot;SRC\,&quot; + ;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fcSysDir + &quot;LIB\&quot;<br>SET PATH TO &lcPath<br>*<br>return <p>David W. Grewe<br><a href=mailto:Dave@internationalbid.net>Dave@internationalbid.net</a><br><a href= > </a><br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top