mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-18 19:29:31 +02:00
IDE: run without debug: use project directory as workdir
This commit is contained in:
parent
fc95ede0b6
commit
0cef9a4b09
32
ide/main.pp
32
ide/main.pp
@ -7345,7 +7345,7 @@ end;
|
||||
function TMainIDE.DoRunProjectWithoutDebug: TModalResult;
|
||||
var
|
||||
Process: TProcessUTF8;
|
||||
RunCmdLine, RunWorkingDirectory, ExeFile: string;
|
||||
RunCmdLine, RunWorkingDirectory, ExeFile, aFilename: string;
|
||||
Params: TStringList;
|
||||
Handled: Boolean;
|
||||
ARunMode: TRunParamsOptionsMode;
|
||||
@ -7374,6 +7374,16 @@ begin
|
||||
Exit(mrNone);
|
||||
end;
|
||||
|
||||
ARunMode := Project1.RunParameterOptions.GetActiveMode;
|
||||
if ARunMode<>nil then
|
||||
RunWorkingDirectory := ARunMode.WorkingDirectory
|
||||
else
|
||||
RunWorkingDirectory := '';
|
||||
if not GlobalMacroList.SubstituteStr(RunWorkingDirectory) then
|
||||
RunWorkingDirectory := '';
|
||||
if (RunWorkingDirectory='') and (not Project1.IsVirtual) then
|
||||
RunWorkingDirectory := ChompPathDelim(Project1.Directory);
|
||||
|
||||
Params := TStringList.Create;
|
||||
Process := TProcessUTF8.Create(nil);
|
||||
try
|
||||
@ -7386,19 +7396,19 @@ begin
|
||||
end;
|
||||
ExeFile := Params[0];
|
||||
Params.Delete(0);
|
||||
//writeln('TMainIDE.DoRunProjectWithoutDebug ExeFile=',ExeFile);
|
||||
Process.Executable := ExeFile;
|
||||
Process.Parameters.Assign(Params);
|
||||
ARunMode := Project1.RunParameterOptions.GetActiveMode;
|
||||
//debugln('TMainIDE.DoRunProjectWithoutDebug ExeFile=',ExeFile);
|
||||
if not FilenameIsAbsolute(ExeFile) then
|
||||
begin
|
||||
aFilename:=FindDefaultExecutablePath(ExeFile);
|
||||
if aFilename<>'' then
|
||||
ExeFile:=aFilename;
|
||||
end;
|
||||
|
||||
if ARunMode<>nil then
|
||||
RunWorkingDirectory := ARunMode.WorkingDirectory
|
||||
else
|
||||
RunWorkingDirectory := '';
|
||||
if not GlobalMacroList.SubstituteStr(RunWorkingDirectory) then
|
||||
RunWorkingDirectory := '';
|
||||
if RunWorkingDirectory = '' then
|
||||
RunWorkingDirectory := ExtractFilePath(ExeFile);
|
||||
|
||||
Process.Executable := ExeFile;
|
||||
Process.Parameters.Assign(Params);
|
||||
Process.CurrentDirectory := RunWorkingDirectory;
|
||||
|
||||
if MainBuildBoss.GetProjectUsesAppBundle
|
||||
|
Loading…
Reference in New Issue
Block a user