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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to find the data

Status
Not open for further replies.

jimstarr

Programmer
Feb 6, 2001
975
US

I'm sure this is simple but I don't see how to do it (VFP9).

If I create an install for my app that allows the user to place the data files in a directory of his choice, how can the app know where they are? Thanks!

Jim

 
Jim,

This is a common problem. The answer really depends on the environment, and the degree of control you have over the user's configuration.

One option is to get the user to tell the app where the data is stored the first time the app is used. You could bring up a prompt that asks the user to navigate to a particular file (using GETFILE() perhaps), for example. Once you have found the file, you can store the location in a special table, or in the registry, or any other convenient location.

Another possibility is for the user to edit an INI file that contains the required location. That's not such a good idea if you are relying on an end user to provide the information, but it might be appropriate if a support person (or yourself) is responsible for the install.

Or, you could write a separate little program that prompts the user for the data location, then installs the data there and writes its location to the registry. You would run this program as a post-install task (in other words, call if from your setup program), instead of the setup program itself installing the data.

These are just a few ideas. No doubt, other people will tell you their favourite method.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 

Create a Constant or global Memvar, and in the main start up program define it with
gcRootPath = ADDBS(SYS(5)+SYS(2003))

Then when you need a file do this.
use (gcRootPath+"DBF\MYTABLE.Dbf") ALIAS WHaTEVER SHARED IN 0

do form (gcRootPath+"FRM\MyForm")

set classlib to (gcRootPath+"VCX\CalssLib.vcx")

Etc...





David W. Grewe Dave
 
Thanks all for the replies so far.

Dave Grewe - doesn't your solution assume that the data files will be in the same directory as the exe? This will not necessarily be true.

Jim
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top