LPI files
lazarus / 13-General
----------------------------------------------------------------------
pcurtis · 2020-08-30 01:11
Hi All,
What is the correct way to open a project? Via lpi or lpr files, or
does it matter?
Is it possible to make Lazarus save all project setting in the lpi
file? I think is saves only the values that are not set to the default
values.
Thanks.
----------------------------------------------------------------------
Leledumbo · 2020-08-30 10:45
Quote from: pcurtis on August 30, 2020, 03:11:37 amWhat is the correct
way to open a project? Via lpi or lpr files, or does it matter?
.lpi, .lpr is basically just another .pas. It may not know where to
find the units it depend on, this information is normally kept in the
.lpi.
Quote from: pcurtis on August 30, 2020, 03:11:37 amIs it possible to
make Lazarus save all project setting in the lpi file? I think is
saves only the values that are not set to the default values.
Guess you have to change the code that does the saving and submit a
patch for it. But I'm not sure if it will be accepted. Some configs
are better left default, so it uses whatever the IDE has by default
instead of per project. It's kind of contradicting, indeed, because
some projects are tailored to specific config. If you can't solve
both, usually the incumbent wins, in the name of backward
compatibility.
----------------------------------------------------------------------
pcurtis · 2020-08-30 12:08
Hi there, thanks for the answer although I'm still not sure about the
lpr / lpi problem.
For example I create a simple project, set Project Options -> Compiler
Options -> Debugging -> Generate info for the debugger to of to off,
save it and run it, close Lazarus.
If I check the lpi file I find
Quote
which confirms that debug info will NOT be generated. To confirm I
reopen the project buy double clicking the lpi file and check in
project options that debugger will NOT be generated. All OK. Close
Lazarus. Open the project by double clicking the LPR icon. Again check
project options to see that debugger info will NOT be created. All OK.
Enable debugger info, save the project and close lazarus.
Check the LPI file and
Quote
is missing - confirming that debug info WILL BE created.
Open the project with the LPR file. Check project options to confirm
that debug info WILL BE created. All OK.
This to me means that if I open a project by dbl clicking the LPR
file, Lazarus still reads the associated LPI file during the open
process. Which to me means I can open a project with the LPR file.
Is this correct? Can you confirm?
----------------------------------------------------------------------
wp · 2020-08-30 13:14
Quote from: pcurtis on August 30, 2020, 02:08:26 pmThis to me means
that if I open a project by dbl clicking the LPR file, Lazarus still
reads the associated LPI file during the open process. Which to me
means I can open a project with the LPR file.
Is this correct? Can you confirm?
Although I always open the lpi files I am rather sure that both
options are rather equivalent normally. I think the primary file is
the lpi file because it lists all the files needed by the project. So,
when I open the lpi file everything should work correctly. On the
other hand, when I open the lpr file, the IDE tries to find the
related lpi file and continues this way.
When, on the other hand, a project is damaged and lacks the lpi file,
for example because it has been submitted incompletely to the forum
here, I open the lpr file and I am prompted to create a default
project. Since the created default lpi file does not know about the
other files and packages needed by the project these files must be
added manually.
BTW, I never open Lazarus project by double-clicking neither lpi nor
lpr files because I have so many Lazarus versions on my PC that I
cannot control which version is associated to the lpi/lpr extension. I
always open projects from the menu (or the Recently-used list).
----------------------------------------------------------------------
pcurtis · 2020-08-30 13:23
Thanks WP, at least you confirmed my thoughts.
----------------------------------------------------------------------
Leledumbo · 2020-08-30 19:14
Apparently not so difficult to confirm the behavior:
Code: Pascal [Select][+][-]window.onload = function(){var x1 =
document.getElementById("main_content_section"); if (x1) { var x =
document.getElementsByClassName("geshi");for (var i = 0; i procedure
OpenProject(aMenuItem: TIDEMenuItem); ... // check
if unit is a program
SourceType:=CodeToolBoss.GetSourceType(PreReadBuf,false); if
(SysUtils.CompareText(SourceType,'PROGRAM')=0) or
(SysUtils.CompareText(SourceType,'LIBRARY')=0) then begin
// source is a program // either this is a lazarus
project // or it is not yet a lazarus project ;)
LPIFilename:=ChangeFileExt(AFilename,'.lpi'); if
FileExistsCached(LPIFilename) then begin if
IDEQuestionDialog(lisProjectInfoFileDetected,
Format(lisTheFileSeemsToBeTheProgramFileOfAnExistingLazarusP,
[AFilename]), mtConfirmation, [mrOk,lisOpenProject2,
mrCancel]) <> mrOk then
exit; AFilename:=LPIFilename;
end