devxlogo

File Locations

File Locations

Question:
I have set Home as C:MyApp in Project Information. VFP has no problem finding the project, but when I do a build and, while running, click a link to a form, it wants to look in the VFP directory or, since I put SET DEFAULT TO C:MyApp in main form Activate code, it wants to look there instead of in: C:MyAppForms. Doesn’t VFP know to look in a Forms subdirectory for a form?

I want the application to find each component (form, database, report, etc.) based on setting a single “Application Home Directory” so that when I deploy it to the target PC, I only need to change a single location setting. Is this possible? I want the application to find each component (form,database,report,etc.) based on setting a single ‘Application Home Directory’ so that when I deploy it to the target PC, I only need to change a single location setting. Possible?

Answer:
You need to use the SET PATH command. When you ask FoxPro for a file without a path in front of it (e.g., DO FORM MyForm vs. DO FORM FormsMyForm) FoxPro looks in the directories specified in its SET(“PATH”) setting, which by default is the current directory only. You need to SET PATH to all directories you need access to under C:MyApp:

 SET PATH TO C:Myapp, C:MyAppForms, C:MyAppDBF, C:MyAppGraphics, ...

Once you have set the default directory (with SET DEFAULT), you don’t need to put the full path of subdirectories of C:MyApp, so the above statement can be simplified to:

 SET DEFAULT TO C:MyAppsSET PATH TO Forms, DBF,Graphics, ...

See also  Why ChatGPT Is So Important Today
devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist