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

FULLPATH problem

Status
Not open for further replies.

amwprogg

Programmer
Jul 8, 2005
52
GB
Hi all.
Having installed an application, I want to get the file
path to the database files. During the install, the user can change the destination directory if they want to.
I've tried using the FULLPATH function, but it doesn't return the full path - and I know the file I specify as one of the parameters exists, and I know what the path should be.
In the install procedure the database directory is [DATABASEDIR] - that's the path I want. Is there a better way of storing this path as a string at the start of my application?
Many Thanks.
Andy.
 
FullPath doesn't return the path, it returns the path plus filename of the file you give as a parameter. Is JustPath() what you want. Combine it with the DBF() or DBC() function depending on whether you need the path to the currently-open database or to the table:
Code:
?JustPath(dbf())
?JustPath(dbc())

Geoff Franklin
 
FULLPATH returns the current full path, if you use it with empty string as parameter:
? FULLPATH("")
 

Andy,

If I've understood your question right, none of these functions (FULLPATH() etc) have got anything to do with yor problem.

In a nutshell, the only way to find out where the user installed the files is to ask the user. As far as I know, there's no obvious way of getting the information from the installation program.

You've got to figure out a way for the user to communicate the information to you (for example, by asking them). Once you've done that, you've got to decide how to store it for your application's future use. That's relatively easy. You could put it in a table, an INI file, a text file, or the registry.

Hope this helps.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

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

Take a look at my post over in thread184-939494. It will give you a very straight forward way of doing this using an INI. When your application starts up for the first time the user will be asked to locate the database directory. Both database directory and install directory are provided for and you end up with _Screen.ClientPath and _Screen.DataPath members to use anywhere in your application. You can modify this to fit whatever you are doing, I am just showing an example of the technique in that thread.

Obviously writing the database path from the install and then picking that up from the application is a little slicker, however the INI approach allows you to reprompt the user again should the data directory ever be moved after installation. So I find it is one of the best approaches. The user only need locate the data directory once or any time it is moved... not too laborious on the user and flexible.

boyd.gif

SweetPotato Software Website
My Blog
 
You could put it in a table, an INI file, a text file, or the registry.

I'd go with craig's Ini method. So very much safer than the registry and easier to maintain. If they hit problems then you can edit the ini file with NotePad, you can talk a user through the process of editting it, or you can email a new ini file across.

Geoff Franklin
 

Another reason to use an INI file is that you can place it somewhere where all users will find it. But registry settings would be a better choice if you want to make the setting specific to a user or a computer (which is not the case here).

Mike




__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
My application can be installed on any location that companies system guy wants to put it and I really never know exactly where the parent folder is. My app goes in its own folder with the database files within it but I never know where the company wants that folder - sounds like your situation.

In out start up module we captue the current path in a global variable so we can access it whenever.

gc_LcPath = SYS(5) + SYS(2003)

This leads us to OUR parent directory which allows our app to always find the database files.

dka
 

DKA,

That's a good approach. I do something similar (except that I use SET DEFAULT TO JUSTPATH(SYS(16)) to set the default directory).

However, Andy's situation is different. He's saying that the user can choose a separate location for the data -- separate from that of the executable. He still faces the problem of getting the user to communicate that choice to the application.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top