[fpc-devel] wrong behaviuor of GetAppConfigDir
ik
idokan at gmail.com
Wed Feb 4 10:52:26 CET 2009
Hello,
GetAppConfigDir takes the title of the application in order to set the
directory where the project will store it's configuration.
This type of behavior is wrong because of:
1. Translating of a program (for example for Hebrew in my case) will
result in different directory
2. The title of the application might change depending on things
inside the program itself.
3. Possible of unsupported chars to be part of the directory name.
My suggestion is to do the following (it's a proof of concept and not
the real code):
function GetAppConfigDir(global : Boolean; AName : String = '') : String;
var
Path : String;
HomeDirectory : String;
begin
HomeDirecory := ...
if global then
path := ...
else
path := HomeDirectory
if Trim(AName) <> '' then
Result := path + DirectorySeperator + Trim(AName)
else
Result := path + DirectorySeperator + ExeName
end;
What do you think of it for next versions of FPC ?
Thanks,
Ido
More information about the fpc-devel
mailing list