Recent

Author Topic: How to set HostApplication with a relative path or something similar?  (Read 2323 times)

EMBarbosa

  • New Member
  • *
  • Posts: 15
Re: How to set HostApplication with a relative path or something similar?
« Reply #15 on: January 03, 2023, 02:27:25 am »
2)

I just tested (Lazarus 2.3 - Win10), this works as host application:
$(ProjSrcPath)\..\foo\project1.exe

Search the IDE for "GlobalMacroList" and you should get all the macros that are added.
I need say this first: Well you are right. I didn't find it before, thank you.

This seems to solve my problem in OP, at least in Windows as "$(ProjSrcPath)\..\..\foo\project1.exe" translates to "c:\project1\..\..\foo\project1.exe".
Then this "semi relative" path ("c:\project1\..\..\foo\project1.exe") can be used with FileExists, and the error is not raised anymore.
So, I'm not sure we **really** need relative paths anymore.
How could we make this more visible in the IDE, Help and Wiki?


Anyway, this code in Main.pp:
Code: Pascal  [Select][+][-]
  1.      
  2.       // Check project build
  3.       ProgramFilename := MainBuildBoss.GetProjectTargetFilename(Project1);
  4. ...
  5.       if ((DebugClass = nil) or DebugClass.RequiresLocalExecutable)
  6.          and not FileExistsUTF8(ProgramFilename)
  7.       then begin
  8.         debugln(['Info: (lazarus) [TMainIDE.DoInitProjectRun] File TargetFile found: "',ProgramFilename,'"']);
  9.         IDEMessageDialog(lisFileNotFound,
  10.           Format(lisNoProgramFileSFound, [ProgramFilename]),
  11.           mtError,[mbCancel]);
  12.         Exit;
  13.       end;
  14.  
Seems wrong to me. I mean not really wrong, but maybe in wrong place.

In my point of view (well, POV of someone not familiar with the IDE code), the responsibility of verify if the debugger can run the project build, should be of the debugger class.
So this code should be in "DebugBoss.InitDebugger" or in something like "DebugBoss.CheckPrerequisites".
« Last Edit: January 04, 2023, 04:01:39 pm by EMBarbosa »

 

TinyPortal © 2005-2018