diff --git a/ide/checkcompileropts.pas b/ide/checkcompileropts.pas index 64e5fa4803..cc96570440 100644 --- a/ide/checkcompileropts.pas +++ b/ide/checkcompileropts.pas @@ -37,7 +37,7 @@ uses KeywordFuncLists, CodeToolManager, FileProcs, DefineTemplates, CodeToolsStructs, // IDEIntf - ProjectIntf, MacroIntf, IDEExternToolIntf, + ProjectIntf, MacroIntf, IDEExternToolIntf, LazIDEIntf, // IDE Project, PackageSystem, ExtToolEditDlg, IDEProcs, EnvironmentOpts, LazarusIDEStrConsts, PackageDefs, CompilerOptions, TransferMacros, LazConf; @@ -302,7 +302,7 @@ begin TestGroupbox.Caption:=dlgCCOTestCompilingEmptyFile; // get Test directory - TestDir:=AppendPathDelim(EnvironmentOptions.TestBuildDirectory); + TestDir:=AppendPathDelim(LazarusIDE.GetTestBuildDirectory); if not DirPathExists(TestDir) then begin MessageDlg(lisCCOInvalidTestDir, Format(lisCCOCheckTestDir,[#13]), diff --git a/ide/environmentopts.pp b/ide/environmentopts.pp index 0e64041ff8..ddf96a343e 100644 --- a/ide/environmentopts.pp +++ b/ide/environmentopts.pp @@ -281,7 +281,6 @@ type FDebuggerShowStopMessage: Boolean; FShowCompileDialog: Boolean; // show dialog during compile FAutoCloseCompileDialog: Boolean; // auto close dialog after succesed compile - FTestBuildDirectory: string; FTestBuildDirHistory: TStringList; FDebuggerEventLogClearOnRun: Boolean; FDebuggerEventLogCheckLineLimit: Boolean; @@ -334,6 +333,7 @@ type function GetDebuggerEventLogColors(AIndex: TDBGEventType): TDebuggerEventLogColor; function GetFPCSourceDirectory: string; function GetLazarusDirectory: string; + function GetTestBuildDirectory: string; procedure SetCompilerFilename(const AValue: string); procedure SetDebuggerEventLogColors(AIndex: TDBGEventType; const AValue: TDebuggerEventLogColor); @@ -504,7 +504,7 @@ type write FShowCompileDialog; property AutoCloseCompileDialog: boolean read FAutoCloseCompileDialog write FAutoCloseCompileDialog; - property TestBuildDirectory: string read FTestBuildDirectory + property TestBuildDirectory: string read GetTestBuildDirectory write SetTestBuildDirectory; property TestBuildDirHistory: TStringList read FTestBuildDirHistory write FTestBuildDirHistory; @@ -1148,7 +1148,7 @@ begin GetDefaultMakeFilenames(FMakeFileHistory); TestBuildDirectory:=XMLConfig.GetValue( - Path+'TestBuildDirectory/Value',FTestBuildDirectory); + Path+'TestBuildDirectory/Value',TestBuildDirectory); LoadRecentList(XMLConfig,FTestBuildDirHistory, Path+'TestBuildDirectory/History/'); if FTestBuildDirHistory.Count=0 then @@ -1486,7 +1486,7 @@ begin SaveRecentList(XMLConfig,FMakeFileHistory, Path+'MakeFilename/History/'); XMLConfig.SetValue( - Path+'TestBuildDirectory/Value',FTestBuildDirectory); + Path+'TestBuildDirectory/Value',TestBuildDirectory); SaveRecentList(XMLConfig,FTestBuildDirHistory, Path+'TestBuildDirectory/History/'); XMLConfig.SetValue( @@ -1682,7 +1682,7 @@ end; function TEnvironmentOptions.GetParsedTestBuildDirectory: string; begin - Result:=AppendPathDelim(TestBuildDirectory); + Result:=GetParsedValue(eopTestBuildDirectory); end; function TEnvironmentOptions.GetParsedFPCSourceDirectory: string; @@ -1903,8 +1903,8 @@ end; procedure TEnvironmentOptions.SetTestBuildDirectory(const AValue: string); begin - if FTestBuildDirectory=AValue then exit; - FTestBuildDirectory:=AppendPathDelim(TrimFilename(AValue)); + if TestBuildDirectory=AValue then exit; + SetParseValue(eopTestBuildDirectory,AValue); end; procedure TEnvironmentOptions.SetLazarusDirectory(const AValue: string); @@ -1953,6 +1953,11 @@ begin Result:=FParseValues[eopLazarusDirectory].UnparsedValue; end; +function TEnvironmentOptions.GetTestBuildDirectory: string; +begin + Result:=FParseValues[eopTestBuildDirectory].UnparsedValue; +end; + procedure TEnvironmentOptions.SetDebuggerEventLogColors(AIndex: TDBGEventType; const AValue: TDebuggerEventLogColor); begin FDebuggerEventLogColors[AIndex] := AValue; diff --git a/ide/frames/project_application_options.pas b/ide/frames/project_application_options.pas index 4993b647f6..351fa49e9d 100644 --- a/ide/frames/project_application_options.pas +++ b/ide/frames/project_application_options.pas @@ -7,8 +7,8 @@ interface uses Classes, SysUtils, LCLProc, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls, StdCtrls, Buttons, ComCtrls, ExtDlgs, Math, LCLType, IDEOptionsIntf, - Project, LazarusIDEStrConsts, EnvironmentOpts, ApplicationBundle, ProjectIcon, - W32Manifest, CompilerOptions; + LazIDEIntf, Project, LazarusIDEStrConsts, EnvironmentOpts, ApplicationBundle, + ProjectIcon, W32Manifest, CompilerOptions; type @@ -68,7 +68,7 @@ begin Exit; end; if AProject.IsVirtual then - TargetExeName := EnvironmentOptions.GetParsedTestBuildDirectory + + TargetExeName := LazarusIDE.GetTestBuildDirectory + ExtractFilename(AProject.MainUnitInfo.Filename) else TargetExeName := AProject.CompilerOptions.CreateTargetFilename( diff --git a/ide/main.pp b/ide/main.pp index a4afc5ad08..70b4c92cfc 100644 --- a/ide/main.pp +++ b/ide/main.pp @@ -10956,7 +10956,7 @@ begin // update all lrs files if sfSaveToTestDir in Flags then - MainBuildBoss.UpdateProjectAutomaticFiles(EnvironmentOptions.TestBuildDirectory) + MainBuildBoss.UpdateProjectAutomaticFiles(EnvironmentOptions.GetParsedTestBuildDirectory) else MainBuildBoss.UpdateProjectAutomaticFiles(''); @@ -11729,11 +11729,14 @@ begin end; function TMainIDE.DoSaveProjectToTestDirectory(Flags: TSaveFlags): TModalResult; +var + TestDir: String; begin Result:=mrCancel; - if (EnvironmentOptions.TestBuildDirectory='') - or (not DirPathExists(EnvironmentOptions.TestBuildDirectory)) then begin - if (EnvironmentOptions.TestBuildDirectory<>'') then begin + TestDir:=GetTestBuildDirectory; + if (TestDir='') + or (not DirPathExists(TestDir)) then begin + if (TestDir<>'') then begin MessageDlg(Format(lisTheTestDirectoryCouldNotBeFoundSeeIDEOpt, [ #13, '"', EnvironmentOptions.TestBuildDirectory, '"', #13]), mtError, [ mbCancel], 0); @@ -12006,7 +12009,7 @@ begin // create target output directory TargetExeName := Project1.CompilerOptions.CreateTargetFilename(Project1.MainFilename); if Project1.IsVirtual and (not FilenameIsAbsolute(TargetExeName)) then - TargetExeName := EnvironmentOptions.GetParsedTestBuildDirectory + TargetExeName; + TargetExeName := GetTestBuildDirectory + TargetExeName; TargetExeDirectory:=ExtractFilePath(TargetExeName); if (FilenameIsAbsolute(TargetExeDirectory)) and (not DirPathExistsCached(TargetExeDirectory)) then begin