[Lazarus] Fpgui directory errors

Santiago A. svaa at ciberpiula.net
Wed Apr 17 12:53:04 CEST 2013


Hello:

I don't know if this is the right place to ask about fpgui, but I don't
know any other ;-)

I lurking fpgui, compiling examples etc. When I tried to run maximus
(The lightweight IDE in examples) I got this exception:

Can't create directory "C:\Documents and Settings\Santi\Configuración
local\Datos de programa\maximus\"

The trace back is:
fpg_iniutils.pas line 89.
  { We used a non-Global config dir, so should be able to create the dir }
  if not fpgForceDirectories(lDir) then
    raise Exception.CreateFmt(rsErrFailedToCreateDir, [lDir]);

//fpg_utils.pas line 150
function fpgExtractFilePath(const FileName: TfpgString): TfpgString;
begin
  Result := ExtractFilePath(fpgToOSEncoding(Filename));
end;   

//fpg_utils.inc line 8
function fpgToOSEncoding(aString: TfpgString): string;
begin
  Result := Utf8ToAnsi(aString);
end;

The problem is with the accent of "Configuración". The treatment of
directories supposes that any string is in utf8 and must be converted to
the OS encoding, in this case to ansi. But in this case gets its value
from GetAppConfigDir (in sysutils), that returns a string already in
ansi encoding. The easier and dirty solution I thought was, before
calling fpgExtractFilePath, apply fpgFromOSEncoding to the value
returned by GetAppConfigDir.

But no way, the problem goes further and then I get a new error
Can't create file "C:\Documents and Settings\Santi\Configuración
local\Datos de programa\maximus\maximus.ini".
I think that there is a little mess about when and where the encoding is.

-- 
Saludos

Santi
svaa at ciberpiula.net





More information about the Lazarus mailing list