>Hi all
>
>When you install an application in a directory you can use relative paths to your external files like your database, reports etc.
>
>But when I start an out of process automation server (which is installed in a particular directory) by creating an object with CREATEOBJECT i cannot open the database because it's default directory is set to the windows/system directory
>
>I cannot find a way to open the database in a subdirecty because i don't know the path to the database since i don't know in which directory the client has installed the automation server.
>
You might try using the FULLPATH(SYS(0)) to get the location of the executable rather than the starting directory. This grabs the exact location that the executable is loaded from rather than the CURDIR(). If the out-of-process server is installed in your application directory, this should let you locate the application directory with minimal effort.
FULLPATH(SYS(0)) will work reliably even when the installation is done to a network drive via UNC. I've had problems at times with using SYS(5) +
some directory path before with pre-VFP6 applications; since the FULLPATH() trick works with drive letter/path or UNC references, I've never even tested to see if SYS(5) works in all conditions under VFP6...
If your out-of-proces server is not installed in your application directory, well, that's what the registry is for...make an entry in the registry in a known location, retrieve it when you start up, and use that for your pathing.
If you use Setup Wizard to create the install for the, you'll want to write a small post-setup executable to grab the install directory (if your post-setup executable is placed in the base install directory, use FULLPATH(SYS(0)) to find where it thinks it lives, strip off the file name, and write that to the registry for your server's reference later on.)
If you relocate the application directory at some point down the road, you can simply rerun the same post-setup executable to update the registry for you.