[Lazarus] The default Lazarus profile directory location

Mattias Gärtner nc-gaertnma at netcologne.de
Thu Jun 4 12:08:35 CEST 2009


Zitat von Graeme Geldenhuys <graemeg.lists at gmail.com>:

> 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);

It's a little bit more complicated. See below.


>> 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.

It seems what is not as obvious as I thought it is. I will try again:
All code that needs the lazarus config directory uses the  
GetPrimaryConfigPath function. For this code it does not matter where  
the profile directory is and if the location changed. They already  
work on all platforms.
Of course some users have written some shell scripts using fixed path.
And some users have written external pascal programs. They probably  
didn't use GetAppConfigDir either. Because it didn't exist at that  
time and because these programs are used for special lazarus setups.
Conclusion:
All platform independent code don't need GetAppConfigDir.
All platform dependent code must be changed when the profile location  
will change.
So no gain in consistency for existing code.


>> 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.

Please give an example.


>> 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.

A 'move' is not simple.
For example when you install a package, the IDE executable lies in the  
config directory. You can not move this under windows while the IDE  
runs.
startlazarus can do that.
What if the move fails for other reasons?


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

Not everyone uses startlazarus.

It will work in many cases. And about all others the developers must  
think and find a solution. It's not a simple boolean flag change.


> 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.

Yes, that's what I meant: all IDE code and add-ons don't care about  
the location. They already work platform independent - since years.


> [...]

Mattias

--
Powered by NetMail





More information about the Lazarus mailing list