ide: run working directory: use exe folder and as fallback the project directory

(cherry picked from commit b38b88bdb5)
This commit is contained in:
mattias 2024-01-14 12:33:19 +01:00 committed by Martin
parent 023766bdda
commit c4c2c20f7c

View File

@ -698,6 +698,7 @@ begin
Result := '';
if Project1=nil then exit;
// first take the WorkDir from the active run parameters
AMode := Project1.RunParameterOptions.GetActiveMode;
if AMode<>nil then
Result := AMode.WorkingDirectory;
@ -706,14 +707,16 @@ begin
if (Result <> '') and not FilenameIsAbsolute(Result) then
Result := CreateAbsolutePath(Result, Project1.Directory);
if (Result='') and (not Project1.IsVirtual) then
Result := ChompPathDelim(Project1.Directory);
// then use the directory of the produced exe
if Result='' then begin
Result := ExtractFilePath(BuildBoss.GetProjectTargetFilename(Project1));
if (Result <> '') and not FilenameIsAbsolute(Result) then
Result := CreateAbsolutePath(Result, Project1.Directory);
end;
// finally use the project directory
if (Result='') and (not Project1.IsVirtual) then
Result := ChompPathDelim(Project1.Directory);
end;
procedure TBuildManager.WriteDebug_RunCommandLine;