Recent

Author Topic: [SOLVED] How to copy/convert the Lazarus-config-folder to a new version?  (Read 666 times)

Hartmut

  • Sr. Member
  • ****
  • Posts: 329
In the past, when I had installed a new Lazarus version, I copied the complete Lazarus-config-folder from the older version over the newer version, because of
 - not to loose all the uncounted changes which I had made in the old Lazarus Options
 - not to loose all the changed file-encodings of my sourcefiles (which are stored in inputhistory.xml)
 - not to loose all the *.lps files which are stored in the subfolder "projectsessions"
 
I did this a couple of times (on Windows and Ubuntu) from Lazarus 1.4.4 ... 2.0.6 and until now never noticed any problems (at the 1st start of Lazarus after this copy there always came a dialog to Upgrade the config folder and another dialog to adapt some path's for Lazarus).

But today I saw by random that file "idemake.cfg" contains a lot of path's which should be wrong after that copy action. So I assume that it was very dangerous what I did...

So please I want to know:
 - which config files must/may I copy without danger, that I don't loose all the uncounted changes which I had made in the old Lazarus Options?
 - may I copy inputhistory.xml without danger?
 - are there more files than "idemake.cfg" which may not be copied?
 
Thanks a lot in advance.
« Last Edit: January 16, 2020, 10:19:01 am by Hartmut »

Hartmut

  • Sr. Member
  • ****
  • Posts: 329
Re: How to copy/convert the Lazarus-config-folder to a new version?
« Reply #1 on: January 14, 2020, 02:35:40 pm »
Hmm, not even 1 answer after 1 week... I'm rather sure that this forum has some experts which have the necessary knowledge... Maybe I asked in the wrong subforum? Which would be the best subforum for this question?

Is it possible to ask an "admin" to move my question into another subforum? How could I do that?

Thanks for any help.

wp

  • Hero Member
  • *****
  • Posts: 6645
Re: How to copy/convert the Lazarus-config-folder to a new version?
« Reply #2 on: January 14, 2020, 03:29:06 pm »
- not to loose all the uncounted changes which I had made in the old Lazarus Options
I have have more than 20 installations on my desktop (plus some more in virtual machines), and I started all from zero. The time to setup a new configuration is nothing compared to finding the error when bugs are propagated from one installation to the other because an error is copied from config to config. I just don't make too many changes...

- not to loose all the changed file-encodings of my sourcefiles (which are stored in inputhistory.xml)
I never change the file encoding, I always use files as they are created by Lazarus. Import from Delphi? I convert the file to utf8 first. I event don't know that inputhistory.xml stores file encodings, I always thought it stores the "recently used files".

- not to loose all the *.lps files which are stored in the subfolder "projectsessions"
I store session files in the project directory along with the other project files.

- which config files must/may I copy without danger, that I don't loose all the uncounted changes which I had made in the old Lazarus Options?
I think there was a recent answer by Martin_fr to a similar question.
Lazarus trunk / fpc 3.0.4 / all 32-bit on Win-10

Hartmut

  • Sr. Member
  • ****
  • Posts: 329
Re: How to copy/convert the Lazarus-config-folder to a new version?
« Reply #3 on: January 14, 2020, 09:02:42 pm »
Hello wp again, thanks for your answers.

- not to loose all the uncounted changes which I had made in the old Lazarus Options
I have have more than 20 installations on my desktop (plus some more in virtual machines), and I started all from zero. The time to setup a new configuration is nothing compared to finding the error when bugs are propagated from one installation to the other because an error is copied from config to config. I just don't make too many changes...
During the years I made a lot of changes to the options of Lazarus to make it as comfortable as possible for my personal needs. And it bothers me extremely, if I stumble over that one Lazarus does not act/react like all the others, because than I can't work quickly and fatigue-proof. Especially a couple of Hotkeys which I changed/added or a couple of Code Templates which I changed/added, just to give 2 examples.
But of course you are right, if copying Lazarus config files causes (hard to find) errors, that's not worth it.
Until now I had no problems, but what I recently saw in "idemake.cfg" gave me a warning. That's the reason I wrote this topic in the hope to learn, which Lazarus config files I may copy and which not.

- not to loose all the changed file-encodings of my sourcefiles (which are stored in inputhistory.xml)
I never change the file encoding, I always use files as they are created by Lazarus. Import from Delphi? I convert the file to utf8 first. I event don't know that inputhistory.xml stores file encodings, I always thought it stores the "recently used files".
My Pascal sources started with Turbo Pascal 3..6 and I live in Germany, where we have special characters (Ä Ö Ü ä ö ü ß). So all these sources had CP850. Mostly I wrote console programs for Windows. The console of Windows 95, XP and Windows 7 on my German PC's had as well CP850. So when I started later with FPC (and even later with Lazarus), it was the easiest to stay my sources with CP850, because then I had to change nothing (I had enough other problems converting my old sources to FPC/Lazarus which were more important to me). From this history all my sources now have CP850. Maybe this decision was not the best for all future, because recently I started with Linux and there is UTF8. But if I would convert all my sources to UTF8, they would show wrong in the console of Windows 7. But all this is one of my smaller problems, I woun't solve it in the near future...

- not to loose all the *.lps files which are stored in the subfolder "projectsessions"
I store session files in the project directory along with the other project files.
I started having an own folder for each project, but found it cumbersome (too much up and down jumping folders from one source to another), especially for my console programs, where a "project" mostly consists only of 2 files (1x lpi and 1x pas). So I have only a couple of folders including the most of my "projects" (with a few exceptions, when a project needs an amount of additional files) and there I find it better to have the *.lps files "out of the way".

- which config files must/may I copy without danger, that I don't loose all the uncounted changes which I had made in the old Lazarus Options?
I think there was a recent answer by Martin_fr to a similar question.
I searched for posts of Martin_fr and the only 2 I found dealing with Lazarus configurations are:
 - https://forum.lazarus.freepascal.org/index.php/topic,47005.0.html
 - https://forum.lazarus.freepascal.org/index.php/topic,46088.0.html
Did you mean one of them?

Have a good night...

wp

  • Hero Member
  • *****
  • Posts: 6645
Re: How to copy/convert the Lazarus-config-folder to a new version?
« Reply #4 on: January 14, 2020, 10:31:12 pm »
- which config files must/may I copy without danger, that I don't loose all the uncounted changes which I had made in the old Lazarus Options?
I think there was a recent answer by Martin_fr to a similar question.
I searched for posts of Martin_fr and the only 2 I found dealing with Lazarus configurations are:
 - https://forum.lazarus.freepascal.org/index.php/topic,47005.0.html
 - https://forum.lazarus.freepascal.org/index.php/topic,46088.0.html
I think it was this one: https://forum.lazarus.freepascal.org/index.php/topic,47480.msg340134.html#msg340134 although I remembered it differentyl. Some config files are mentioned there, but Martin warned that environmentoptions (which contains most of your requests) will make trouble because it contains the FPC path.

Ideally somebody should write a program and make it available which copies these files and makes path adjustments if required. The post https://forum.lazarus.freepascal.org/index.php/topic,46436.msg331534.html#msg331534 refers to a program for creation of a portable Lazarus version, but it must also copy config files and should contain much to learn from.
Lazarus trunk / fpc 3.0.4 / all 32-bit on Win-10

Hartmut

  • Sr. Member
  • ****
  • Posts: 329
Re: How to copy/convert the Lazarus-config-folder to a new version?
« Reply #5 on: January 15, 2020, 06:08:04 pm »
I think it was this one: https://forum.lazarus.freepascal.org/index.php/topic,47480.msg340134.html#msg340134 although I remembered it differentyl. Some config files are mentioned there, but Martin warned that environmentoptions (which contains most of your requests) will make trouble because it contains the FPC path.

Thanks a lot, wp for finding that link. Martin mentioned there 2 files namely:

 - environmentoptions.xml: I had a close look into it. It contains 5 path's to Lazarus, Compiler, FPC-Sources, Make and the Debugger. Of course they must be correct. But in every case, where I copied a formerly Lazarus config folder over a just new installed Lazarus config folder, at the 1st Lazarus start I got a dialog (see attached Lazarus_IDE_config.png) to configure this 5 path's. So from my evaluation, it is no problem to copy the whole environmentoptions.xml, if afterwards this dialog appears and you check/adapt this 5 path's. If this opinion should be wrong, I would be very interested to hear from that, thanks.

 - editoroptions.xml: although Martin wrote, this file should be fine to copy, it includes the path to the Code Templates Module. So my recommendation would be, after having copied this file, to start Lazarus / Menu Tools / Code Templates / and to adapt the path in "Module" from the old Lazarus config folder to the new one to avoid later problems (e.g. if you someday delete the old config folder).

And Martin wrote there, that many other of the XML-files should be fine to copy (which gives me hope).

Ideally somebody should write a program and make it available which copies these files and makes path adjustments if required.
That would be great (I would buy it immediately). There exists already a "Lazarus config folder upgrade dialog" (see attached Lazarus_incorrect_config.png) which appears, when you start Lazarus after having copied an older Lazarus config folder over the current one. Initially I expected, that this dialog would adapt everything necessary...

The post https://forum.lazarus.freepascal.org/index.php/topic,46436.msg331534.html#msg331534 refers to a program for creation of a portable Lazarus version, but it must also copy config files and should contain much to learn from.
Thanks for that info too. I looked into this program and as far as I understood, it makes the following changes to the Lazarus config folder (and a couple of things outside this folder):
 - adapt Compiler path in environmentoptions.xml
 - delete the history of Lazarus, Compiler, FPC-Sources, Make the Debugger and some more in environmentoptions.xml
 - adapts something in onlinepackagemanager\config\options.xml
 - adapts CodeTemplateFileName in editoroptions.xml
So the only thing we did not already know is to adapt onlinepackagemanager\config\options.xml
« Last Edit: January 15, 2020, 06:10:41 pm by Hartmut »

lucamar

  • Hero Member
  • *****
  • Posts: 2264
Re: How to copy/convert the Lazarus-config-folder to a new version?
« Reply #6 on: January 15, 2020, 07:12:12 pm »
There exists already a "Lazarus config folder upgrade dialog" (see attached Lazarus_incorrect_config.png) which appears, when you start Lazarus after having copied an older Lazarus config folder over the current one. Initially I expected, that this dialog would adapt everything necessary...

It does except where it can't know what changes to make, which is probably what happens with inputhistory.xml (after all encodings are saved there only when you tell the IDE they are other than the default).

As for idemake.cfg, the other file you're "worried" about, note that it will be completely rebuilt as soon as you use "Tools->Build IDE", so it really doesn't matter what it contains before that: you can copy it over (or not, if you wish) from an old installation without issues.

HTH!
« Last Edit: January 15, 2020, 07:15:38 pm by lucamar »
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus 2.0.4/2.0.6  - FPC 3.0.4 on:
(K|L)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 5906
    • wiki
Re: How to copy/convert the Lazarus-config-folder to a new version?
« Reply #7 on: January 15, 2020, 08:48:08 pm »
If you often move files, fix your config to use macros: https://wiki.lazarus.freepascal.org/IDE_Macros_in_paths_and_filenames#Paths_and_Parts

e.g $(LazarusDir)/..... for anything in the lazarus folder.


The primary-config-path can be set via https://wiki.lazarus.freepascal.org/Multiple_Lazarus#Using_lazarus.cfg_file



Most folders you can probably fix by looking (grep) for
- the current laz dir
- the config dir
- the fpc dir, if that is a separate install
- the gdb dir, if that is a separate install
- any other path you added yourself.... (eg. 3rd party packages)

Make a list of them so you can check before each copy. In case a newer IDE saves paths in new locations.
« Last Edit: January 15, 2020, 08:51:11 pm by Martin_fr »

Hartmut

  • Sr. Member
  • ****
  • Posts: 329
Re: How to copy/convert the Lazarus-config-folder to a new version?
« Reply #8 on: January 16, 2020, 10:18:35 am »
Thanks a lot to lucamar and Martin_fr for your additional and helpful informations I did not know before. I created a checklist with the infos from this topic to use it in the future.