[fpc-pascal] GetAppConfigDir(False) in a Citrix environment

Michael Van Canneyt michael at freepascal.org
Thu Jun 28 08:49:30 CEST 2018



On Thu, 28 Jun 2018, Bart wrote:

> Hi,
>
> One of my apps also runs in a Citrix environment.
> It does not retrieve it's settings.
>
> If appears that GetAppConfigDir(False) returns
> "C:\Users\<username>\AppData\Local".
> (%LOCALAPPDATA%=C:\Users\902617\AppData\Local)
> Whereas %APPDATA% points to "\\prof001\profiles\<username>\AppData",
> and this is also the location where programs like FireFox write there
> config files to.
>
> While my program actually writes to
> "C:\Users\<username>\AppData\Local\somsubfolder\programname.ini" (the
> file exists and contains the content it should have), upon restart of
> the program that ini file does not exist anymore.
> So this location is pretty useless.
>
> Any thoughts on retrieving the sensible place to store configuration
> files in such an environment, or how to detect I'm in such an
> environment?

https://stackoverflow.com/questions/4186153/api-for-determining-if-app-is-running-on-citrix-or-terminal-services
https://helgeklein.com/blog/2014/08/app-running-citrix-xendesktopxenapp/

AppConfigDir uses

GetWindowsSpecialDir(CSIDL_LOCAL_APPDATA);

if you see you're under Citrix, you could use

GetWindowsSpecialDir(CSIDL_APPDATA);

Michael.



More information about the fpc-pascal mailing list