[Lazarus] GetAppConfigDir problem

Lee Jenkins lee at datatrakpos.com
Mon May 5 23:13:06 CEST 2008


Graeme Geldenhuys wrote:
> Hi Lee,
> 
> 2008/5/5 Lee Jenkins <lee at datatrakpos.com>:
>>  On Windows, this method returns the application's directory.  IMO, this is wrong
>>  since its customary to install applications in the Program Files directory and
>>  with tighter locked down XP/2000 and DEFINITELY Vista, this is a problem since
>>  you are not usually given permission to write in these destinations now.
> 
> I thought GetAppConfigDir () returns the '\documents and
> settings\<profile>\application data\<appname> path? Specifying the
> global parameter would return: '\documents and settings\all
> users\application data\<appname>'
> 
> Am I mistaken? The above behaviours should work just fine for locked
> down NT/Win2000 systems and Vista with UAC enabled, because the user
> should have write access to there profile directory.
> 
> 

GetAppConfigDir returns the user's local folder when you specify false as the 
global parameter, but when you you specify true, it returns the application's 
directory.

 From SysUtils.pas:

Function GetAppConfigDir(Global : Boolean) : String;

begin
   If Global then
     Result:=DGetAppConfigDir(Global) // or use windows dir ??
   else
     begin
     Result:=GetSpecialDir(CSIDL_LOCAL_APPDATA)+ApplicationName;
     If (Result='') then
       Result:=DGetAppConfigDir(Global);
     end;
end;


-- 

Warm Regards,

Lee

"When my company started out, we were really, really, really, really small. 
Now...we're just really small."



More information about the Lazarus mailing list