Find $ HOME or Windows equivalent with FreePascal

My goal is to deploy user config files under:

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

What are the APIs or group of functions that I can use, with the appropriate {$ IFDEF} so I can deploy my config files to the appropriate locations?

0


a source to share


2 answers


Better to use the correct function:

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



Result: = getappconfigdir (false)

+1


a source


You probably end up using the function GetEnvironmentVariable

. On a Unix-like OS, you will use an environment variable HOME

. On Windows, you will be using an environment variable APPDATA

.



+1


a source







All Articles