Recent

Author Topic: IDE keeps grabbing units from other projects  (Read 2336 times)

robert rozee

  • New Member
  • *
  • Posts: 33
IDE keeps grabbing units from other projects
« on: July 01, 2021, 04:26:49 pm »
hi,
    lazarus is driving me insane. i'm using version is 2.0.12 running under linux mint, fpc version 3.2.0, however the problems started with version 2.0.10 (i had hoped doing an upgrade might fix it).

i think something is broken in a config file somewhere, such that lazarus is using paths from previously opened projects instead of using the .lpi and .lps files in the current directory. the result is: i can double-click on a project1.lpr file in a directory called ./pascal/T2/folder1 and the ide will open up a unit1.pas file from the directory ./pascal/T2/folder3 instead.

worse still, if i double-click on ./pascal/T2/folder1/unit1.pas the ide instead opens the file ./pascal/T2/folder3/unit1.pas.

as you might imagine, it took a while to work out what was going on, meanwhile completely trashing several smaller projects, and almost trashed a fairly large project i've been working on.


another way of viewing the manifestation of this:
create a simple project (a button on a form that pops up a 'hello world' message will suffice), then export the project to a directory called 'ABC' using:
"project" -> "publish project"
now go to the zip file created, and extract the contents to a directory called 'DEF'. if you then double-click on the project1.lpr file, the IDE opens a blank project.


i feel my first line of attack should be to completely clear out all the lazarus configuration files. am quite happy to re-install lazarus in the process. to date i've tried deleting the ./.lazarus directory, but this has provided no improvement.


can anyone help save my sanity?!


cheers,
rob   :-)

lucamar

  • Hero Member
  • *****
  • Posts: 4219
Re: IDE keeps grabbing units from other projects
« Reply #1 on: July 01, 2021, 05:44:54 pm »
can anyone help save my sanity?!

Lazarus associates .lpi/.lpr files to startlazarus; unfortunately, there seems to be some bug in 2.0.12 which makes it to not pass the file name to lazaus-ide, so instead it opens the previous project, if any.

As a workaround, you can change the association so that instead of opening those files with startlazarus they are opened by lazarus-ide.

As a side note, you should be double-clicking the .lpi, not the .lpr, though that has no bearing with this problem ;)
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

robert rozee

  • New Member
  • *
  • Posts: 33
Re: IDE keeps grabbing units from other projects
« Reply #2 on: July 01, 2021, 07:59:49 pm »
brilliant, that seems to fix it!   :D   have associated all the file types with lazarus-ide and now projects open sanely.


a couple of questions:

1. as a more 'tidy' fix, would there be any harm in deleting startlazarus and replace it with a symlink to lazarus-ide?

2. has this problem been reported as a bug within the lazarus/fpc bug tracking system?


cheers,
rob   :-)

lucamar

  • Hero Member
  • *****
  • Posts: 4219
Re: IDE keeps grabbing units from other projects
« Reply #3 on: July 01, 2021, 08:17:49 pm »
1. as a more 'tidy' fix, would there be any harm in deleting startlazarus and replace it with a symlink to lazarus-ide?

There should be no harm. Only you've to be careful if you've installed any additional packages, since (at least in Linux) one of the purposes of startlazarus is to ascertain whether it shoud launch the "original" lazarus-ide from /usr/share/lazarus or the re-compiled one from ~/.lazarus

Quote
2. has this problem been reported as a bug within the lazarus/fpc bug tracking system?

Good question ... of which I don't quite remember the answer. I kind of recall I didn't open an issue because it was reported already, but I'm not entirely sure :-[
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

 

TinyPortal © 2005-2018