spiegel-keyman/developer/src/tike/project/Keyman.Developer.UI.Project.UfrmProjectSettings20.pas
Marc Durdin 55c0c6fd08 fix(developer): projects 2.0 internal path enumeration
Restricts enumeration of files for the project to the project folder and
the SourcePath folder. This prevents problems where a project may be in
a folder with many subfolders which would take a long time to enumerate,
and avoids confusion where there are source-type files in other folders.

At the same time, sorts out forward slash vs backslash in paths. While
forward slash works in many scenarios, there are several filename
manipulation functions, such as ExpandFileName, which would build valid
but non-optimal paths when forward slashes were encountered, which
cascaded into files appearing to be different and presentation issues.
2023-11-16 11:47:35 +07:00

83 lines
2.7 KiB
ObjectPascal

(*
Name: Keyman.Developer.UI.Project.UfrmProjectSettings
Copyright: Copyright (C) SIL International.
Documentation:
Description:
Create Date: 4 May 2015
Modified Date: 24 Aug 2015
Authors: mcdurdin
Related Files:
Dependencies:
Bugs:
Todo:
Notes:
History: 04 May 2015 - mcdurdin - I4688 - V9.0 - Add build path to project settings
24 Aug 2015 - mcdurdin - I4865 - Add treat hints and warnings as errors into project
24 Aug 2015 - mcdurdin - I4866 - Add warn on deprecated features to project and compile
*)
unit Keyman.Developer.UI.Project.UfrmProjectSettings20; // I4688
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls;
type
TfrmProjectSettings20 = class(TForm)
lblOutputPath: TLabel;
editOutputPath: TEdit;
Label2: TLabel;
cmdOK: TButton;
cmdCancel: TButton;
Label3: TLabel;
Label6: TLabel;
chkCompilerWarningsAsErrors: TCheckBox;
chkWarnDeprecatedCode: TCheckBox;
chkCheckFilenameConventions: TCheckBox;
lblSourcePath: TLabel;
editSourcePath: TEdit;
chkBuildMetadataFiles: TCheckBox;
procedure FormCreate(Sender: TObject);
procedure cmdOKClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
implementation
{$R *.dfm}
uses
Keyman.Developer.System.Project.Project,
utildir;
procedure TfrmProjectSettings20.cmdOKClick(Sender: TObject);
begin
FGlobalProject.Options.BuildPath := Trim(DosSlashes(editOutputPath.Text));
FGlobalProject.Options.SourcePath := Trim(DosSlashes(editSourcePath.Text));
FGlobalProject.Options.SkipMetadataFiles := not chkBuildMetadataFiles.Checked;
FGlobalProject.Options.CompilerWarningsAsErrors := chkCompilerWarningsAsErrors.Checked; // I4865
FGlobalProject.Options.WarnDeprecatedCode := chkWarnDeprecatedCode.Checked; // I4866
FGlobalProject.Options.CheckFilenameConventions := chkCheckFilenameConventions.Checked;
FGlobalProject.Save;
ModalResult := mrOk;
end;
procedure TfrmProjectSettings20.FormCreate(Sender: TObject);
begin
editOutputPath.Text := FGlobalProject.Options.BuildPath;
editSourcePath.Text := FGlobalProject.Options.SourcePath;
chkBuildMetadataFiles.Checked := not FGlobalProject.Options.SkipMetadataFiles;
chkCompilerWarningsAsErrors.Checked := FGlobalProject.Options.CompilerWarningsAsErrors; // I4865
chkWarnDeprecatedCode.Checked := FGlobalProject.Options.WarnDeprecatedCode; // I4866
chkCheckFilenameConventions.Checked := FGlobalProject.Options.CheckFilenameConventions;
if editOutputPath.Text = '' then editOutputPath.Text := '$PROJECTPATH';
end;
end.