How to set the private directory to the applications' subdirectory (Views: 100)


I'm wondering how one can set the privatedir. I don't mean in my program, but just so I know where the temp files go. Does the BDEcfg program do that? If so, where? I'm using BDE 4.0


Your program sets the private directory, it's not in the cfg. If you don't set it in your program it defaults to the apps directory. If your app resides on a server in a multiple use environment this is not what you want. I add the following code to all my apps (I also limit my apps to one instance):

s := ' C:\AZPC\PRIVATE\' + ChangeFileExt(ExtractFileName(Application.ExeName), '.');
if not DirectoryExists(s) then
  if not DirectoryExists(s) then
    ShowMessage('Unable to find and/or create the ' + #10 + s + #10 + ' directory '
      + #10 + ' the program will run, but not be fully functional.');
Session.PrivateDir := s;

This sets the private directory to the exe name subdirectory on the C: drive.

<< Back to main page