Friday, May 6, 2011

Find $HOME or Windows equivalent with FreePascal

My purpose is to deploy user configuration files under:

  • $HOME/.appname for Unix/Linux.
  • \Documents and Settings\(user)\Application Data\AppName for Windows.

What are the API's or group of functions that I can use, with the appropriate {$IFDEF}'s, so I can deploy my config files on the appropriate places?

From stackoverflow
  • You'll likely end up using the GetEnvironmentVariable function. Under Unix-like OSs, you will use the HOME environment variable. Under Windows, you'll use the APPDATA environment variable.

    Gustavo Carreno : Thanks mate. It's good to know that it works fine, and the same way, under both Windows and *NIX systems.
  • Better use the correct function:

    http://www.freepascal.org/docs-html/rtl/sysutils/getappconfigdir.html

    result:=getappconfigdir(false)

    Gustavo Carreno : As usual, you da man !!! eheheheh

0 comments:

Post a Comment