[Lazarus] The default Lazarus profile directory location

Graeme Geldenhuys graemeg.lists at gmail.com
Thu Jun 4 11:17:45 CEST 2009


2009/6/4 Mattias Gaertner <nc-gaertnma at netcologne.de>:
>
> It does not *simply* call GetAppConfigDir. For example it considers the
> command line parameters.

Well that is hardly and issue... considering the following pseudocode:

if pcpParam then
  profiledir := pcpParamStr
else
  profiledir := GetAppConfigDir(False);



> IDE code and add-ons use the GetPrimaryConfigPath, which do more than a
> simple GetAppConfigDir.

The end result is the same, no matter what you call the function. It
returns a profile directory location.


> My only arguments are:
> Consistency: I don't see why this is more consistent

Instead of having different behaviors (code) for different platforms,
the GetAppConfigDir() could be used which makes the lazarus ide code
simpler and consistent between supported platforms. The same code gets
used for all supported platforms.


> Change: It is not compatible and will give some users some extra
> headache and it will give developers extra work to test and consider
> all cases.

The developers shouldn't notice anything different. If they upgrade to
the new version of lazarus, the 'startlazarus' program could notify
the user that the profile directory moved, and then simply move it for
them, and then continue loading the ide.  If the user specific a --pcp
parameter, that takes preference anyway, so no moving of profile
directories will occur.

What the cause of the headache? The startlazarus program does
everything for the developer.


As a quick test I applied the following patch which changed the
hard-coded profile directory location to use GetAppConfigDir(False). I
then moved my ~/.lazarus directory to ~/.config/lazarus and then ran
lazarus as normal. Everything worked as expected, all my custom
settings was detected.


============== profiledir.patch ===============
diff --git a/ide/include/unix/lazbaseconf.inc b/ide/include/unix/lazbaseconf.inc
index fd2cab1..0cef80b 100644
--- a/ide/include/unix/lazbaseconf.inc
+++ b/ide/include/unix/lazbaseconf.inc
@@ -141,7 +141,7 @@ end;
  ---------------------------------------------------------------------------}
 procedure InternalInit;
 begin
-  PrimaryConfigPath:=ExpandFileNameUTF8('~/.lazarus');
+  PrimaryConfigPath:=SysToUTF8(GetAppConfigDir(False));
   SecondaryConfigPath:='/etc/lazarus';
 end;

=================  end ===================


I even started lazarus by running 'startlazarus' and 'lazarus' and in
both cases, it worked perfectly. No headaches. :-)

==========  console output  ==============
$ ./startlazarus
TLazarusManager.Run starting /opt/git/lazarus_argon/lazarus ...
TMainIDE.ParseCmdLineOptions:
  PrimaryConfigPath="/home/graemeg/.config/lazarus/"
  SecondaryConfigPath="/etc/lazarus"
LAZARUS END - cleaning up ...
[TMainIDE.Destroy] A
[TMainIDE.Destroy] B  -> inherited Destroy... TMainIDE
[TMainIDE.Destroy] END


$ ./lazarus
TMainIDE.ParseCmdLineOptions:
  PrimaryConfigPath="/home/graemeg/.config/lazarus/"
  SecondaryConfigPath="/etc/lazarus"
LAZARUS END - cleaning up ...
[TMainIDE.Destroy] A
[TMainIDE.Destroy] B  -> inherited Destroy... TMainIDE
[TMainIDE.Destroy] END

==============  end  ==================


So setting PrimaryConfigPath variable used in the various platform
specific include files can now be moved to a common location. And now
GetAppConfigDir(False) is used as it's original purpose intended.


Regards,
  - Graeme -


_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/




More information about the Lazarus mailing list