* * *

Author Topic: lazarus.cfg overrides --primary-config-path vs. --pcp  (Read 512 times)

ase

  • Newbie
  • Posts: 3
lazarus.cfg overrides --primary-config-path vs. --pcp
« on: July 30, 2018, 05:35:15 pm »
Hi Forum,

there seems to be no way to override the lazarus.cfg file which tells the ide and lazbuild.exe where to find the primary-configuration-path.
lazarus.cfg has higher priority than the command line parameter. The easiest solution of course would be to delete this file and always pass the parameter.
Since lazarus.cfg is created by the installer a better solution would be nice.

My installation is as follows:
-32 bit IDE in "c:\lazarus32"
-64 bit IDE in "c:\lazarus64"
-both directories have a lazarus.cfg pointing to config directories that I want to use for coding

I need to have different configuration paths because I want to switch back and fourth between different packagefiles.xml Those files point to different branches/tags of the same packages.

Possible solutions:
--ignore-lazarus-cfg
--lazarus-cfg=path


Kind regards,
   André
« Last Edit: July 31, 2018, 04:42:54 pm by ase »

wp

  • Hero Member
  • *****
  • Posts: 4838
Re: lazarus.cfg overrides --primary-configuration-path
« Reply #1 on: July 30, 2018, 06:06:09 pm »
there seems to be no way to override the lazarus.cfg file which tells the ide and lazbuild.exe where to find the primary-configuration-path.
lazarus.cfg has higher priority than the command line parameter.
This is not correct - I just tested it: called one of my Laz-Installations (having a lazarus.cfg)  with "--pcp=d:\test", and there was a folder "test" on drive d: afterwards.

The easiest solution of course would be to delete this file and always pass the parameter.
Why don't you do it? And nothing prevents you from editing the file - it is a simple text file.

BTW: Did you use the correct word for the command line parameter? "--primary-configuration-path=..." that you mention in the title of this post is wrong, it should be "--primary-config-path=..." or shorter "--pcp=..."
« Last Edit: July 30, 2018, 09:59:30 pm by wp »
Lazarus trunk / fpc 3.0.4 / all 32-bit on Win-10

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 4734
    • wiki
Re: lazarus.cfg overrides --primary-configuration-path
« Reply #2 on: July 30, 2018, 06:52:33 pm »
Afaik / IIRC a parameter given on the command line should take precedence over a parameter given in lazarus.cfg. However I am not sure what happens if you mix different writings of the same param. E.g. -pcp vs --primary-config-path.  (mixing them like this may not be supported).

If you use the exact same spelling in the file and the commandline, then it should work.


There may be yet another solution (but I am not sure / have not tested it / and it may fail, if you use File=>Restart).
The lazarus.cfg file is also seen by startlazarus. And then passed to lazarus as commandline args. So (I guess) if you have different folders, each just with startlazarus.exe and lazarus.cfg then that might do what you want. Of course in the config to which you point, the real lazarus directory needs to be configured, so startlazarus will find the lazarus.exe.

edit: I might be wrong, it may be that startlazarus will only find the lazarus.exe, if the latter is in the pcp (together with the xml files, or in a subfolder thereof)
« Last Edit: July 30, 2018, 06:55:10 pm by Martin_fr »

ase

  • Newbie
  • Posts: 3
Re: lazarus.cfg overrides --primary-config-path vs. --pcp
« Reply #3 on: July 31, 2018, 04:41:43 pm »
Hello Martin_fr and wp,

you are both right.

However I am not sure what happens if you mix different writings of the same param. E.g. -pcp vs --primary-config-path.  (mixing them like this may not be supported).

This is indeed my mistake. When I correctly pass "--primary-config-path" on the command line to lazbuild.exe instead of "--pcp" it works as expected.

This is not correct - I just tested it: called one of my Laz-Installations (having a lazarus.cfg)  with "--pcp=d:\test", and there was a folder "test" on drive d: afterwards.

You are right - when I start lazarus.exe it correctly uses the given path in --pcp but unfortunately lazbuild does not. I called --add-package-link and the link ended up in the IDE's lazarus.cfg directory.

Lastly - the reason why I don't want to delete lazarus.cfg is because we have multiple other developers happily working with lazarus. I don't want to mess with their installations. Using lazbuild in a way that always works for all is the better approach.

Thank you both, it really helped me a lot.

Kind regards,
   André

p.s.: I changed the subject in order not to spread more confusion

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 4734
    • wiki
Re: lazarus.cfg overrides --primary-config-path vs. --pcp
« Reply #4 on: July 31, 2018, 05:04:06 pm »
You are right - when I start lazarus.exe it correctly uses the given path in --pcp but unfortunately lazbuild does not. I called --add-package-link and the link ended up in the IDE's lazarus.cfg directory.

Please report the lazbuild part as a bug on mantis (link to the bugtracker is in the forum menu). Thanks

ase

  • Newbie
  • Posts: 3
Re: lazarus.cfg overrides --primary-config-path vs. --pcp
« Reply #5 on: July 31, 2018, 06:00:37 pm »
https://bugs.freepascal.org/view.php?id=34069

Don't know if the IDE is the right category, though.

 

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus