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

This commit is contained in:
mattias 2024-01-14 12:33:19 +01:00
parent 9f62dd37a3
commit b38b88bdb5

View File

@ -717,6 +717,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;
@ -725,14 +726,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;