mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-08 06:35:59 +02:00
IDE: Run/Debug, search for LaunchApp and HostApp in Project-dir and %Path. issue #32331
- Search in %PATH was done by "run without debug", but not by debug. - Checking for an exe relative to the project-dir was added for both. - A plain file-name will be first checked in the project-dir, and after that in %PATH
This commit is contained in:
parent
66bc8c9281
commit
a1b61028fa
@ -55,7 +55,7 @@ uses
|
||||
IdeDebuggerStringConstants,
|
||||
// IDE
|
||||
CompilerOptions, EnvironmentOpts, SourceEditor, ProjectDefs, Project,
|
||||
InputHistory, Debugger, LazarusIDEStrConsts, TransferMacros, MainBar,
|
||||
InputHistory, LazConf, Debugger, LazarusIDEStrConsts, TransferMacros, MainBar,
|
||||
MainIntf, MainBase, BaseBuildManager, SourceMarks, DebuggerDlg, Watchesdlg,
|
||||
BreakPointsdlg, BreakPropertyDlg, LocalsDlg, WatchPropertyDlg, CallStackDlg,
|
||||
EvaluateDlg, RegistersDlg, AssemblerDlg, DebugOutputForm, ExceptionDlg,
|
||||
@ -308,6 +308,7 @@ function GetDebugManager: TDebugManager;
|
||||
property DebugBossMgr: TDebugManager read GetDebugManager;
|
||||
|
||||
function DBGDateTimeFormatter(const aValue: string): string;
|
||||
function ResolveLocationForLaunchApplication(ALaunchApp: String): String;
|
||||
|
||||
implementation
|
||||
|
||||
@ -340,6 +341,25 @@ begin
|
||||
Result := aValue;
|
||||
end;
|
||||
|
||||
function ResolveLocationForLaunchApplication(ALaunchApp: String): String;
|
||||
var
|
||||
tmp: String;
|
||||
begin
|
||||
Result := ALaunchApp;
|
||||
if not FilenameIsAbsolute(ALaunchApp) then begin
|
||||
tmp := CreateAbsolutePath(ALaunchApp, Project1.Directory);
|
||||
if FileIsExecutable(tmp) then begin
|
||||
Result := tmp;
|
||||
end
|
||||
else
|
||||
if ExtractFilePath(ALaunchApp) = '' then begin
|
||||
tmp := FindDefaultExecutablePath(ALaunchApp);
|
||||
if tmp <> '' then
|
||||
Result := tmp;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
type
|
||||
|
||||
{ TManagedBreakPoint }
|
||||
@ -2514,6 +2534,9 @@ begin
|
||||
LaunchingCmdLine := BuildBoss.GetRunCommandLine;
|
||||
SplitCmdLine(LaunchingCmdLine, LaunchingApplication, LaunchingParams);
|
||||
|
||||
if NewDebuggerClass.RequiresLocalExecutable then
|
||||
LaunchingApplication := ResolveLocationForLaunchApplication(LaunchingApplication);
|
||||
|
||||
(* TODO: workaround for http://bugs.freepascal.org/view.php?id=21834
|
||||
Se Debugger.RequiresLocalExecutable
|
||||
*)
|
||||
|
10
ide/main.pp
10
ide/main.pp
@ -7402,7 +7402,7 @@ begin
|
||||
if ConsoleVerbosity>0 then
|
||||
DebugLn(['Hint: (lazarus) [TMainIDE.DoInitProjectRun] ProgramFilename=',ProgramFilename]);
|
||||
if ((DebugClass = nil) or DebugClass.RequiresLocalExecutable)
|
||||
and not FileExistsUTF8(ProgramFilename)
|
||||
and not FileExistsUTF8(ResolveLocationForLaunchApplication(ProgramFilename))
|
||||
then begin
|
||||
debugln(['Info: (lazarus) [TMainIDE.DoInitProjectRun] File TargetFile found: "',ProgramFilename,'"']);
|
||||
IDEMessageDialog(lisFileNotFound,
|
||||
@ -7520,13 +7520,7 @@ begin
|
||||
ExeFile := Params[0];
|
||||
Params.Delete(0);
|
||||
//debugln('TMainIDE.DoRunProjectWithoutDebug ExeFile=',ExeFile);
|
||||
if not FilenameIsAbsolute(ExeFile) then
|
||||
begin
|
||||
aFilename:=FindDefaultExecutablePath(ExeFile);
|
||||
if aFilename<>'' then
|
||||
ExeFile:=aFilename;
|
||||
end;
|
||||
|
||||
ExeFile := ResolveLocationForLaunchApplication(ExeFile);
|
||||
|
||||
Process.Executable := ExeFile;
|
||||
Process.Parameters.Assign(Params);
|
||||
|
Loading…
Reference in New Issue
Block a user