mirror of https://gitlab.com/basile.b/dexed.git
added run parameters <files> -f <files> -p <project> --plugs=OFF
This commit is contained in:
parent
444a297cee
commit
9866d5fd49
|
@ -135,7 +135,7 @@
|
|||
<PackageName Value="LCL"/>
|
||||
</Item6>
|
||||
</RequiredPackages>
|
||||
<Units Count="22">
|
||||
<Units Count="23">
|
||||
<Unit0>
|
||||
<Filename Value="coedit.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
|
@ -276,6 +276,11 @@
|
|||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="ce_dcd"/>
|
||||
</Unit21>
|
||||
<Unit22>
|
||||
<Filename Value="..\src\ce_customtools.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="ce_customtools"/>
|
||||
</Unit22>
|
||||
</Units>
|
||||
</ProjectOptions>
|
||||
<CompilerOptions>
|
||||
|
|
|
@ -0,0 +1,85 @@
|
|||
unit ce_customtools;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, process, ce_common;
|
||||
|
||||
type
|
||||
|
||||
TCEToolItem = class(TCollectionItem)
|
||||
private
|
||||
fExecutable: string;
|
||||
fWorkingDir: string;
|
||||
fShowWin: TShowWindowOptions;
|
||||
fProcess: TProcess;
|
||||
function getParameters: TStringList;
|
||||
procedure setParameters(const aValue: TStringList);
|
||||
published
|
||||
property executable: string read fExecutable write fExecutable;
|
||||
property workingDirectory: string read fWorkingDir write fWorkingDir;
|
||||
property parameters: TStringList read getParameters write setParameters;
|
||||
property showWindows: TShowWindowOptions read fShowWin write fShowWin;
|
||||
public
|
||||
constructor create(ACollection: TCollection); override;
|
||||
destructor destroy; override;
|
||||
//
|
||||
property process: TProcess read fProcess;
|
||||
procedure execute;
|
||||
end;
|
||||
|
||||
TCETools = class(TCollection)
|
||||
private
|
||||
function getItem(index: Integer): TCEToolItem;
|
||||
public
|
||||
constructor create(itemClass: TCollectionItem) override;
|
||||
//
|
||||
property tool[index: integer]: TCEToolItem read getItem;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
CEMainForm;
|
||||
|
||||
constructor TCEToolItem.create(ACollection: TCollection);
|
||||
begin
|
||||
inherited;
|
||||
fProcess := TProcess.Create(nil);
|
||||
end;
|
||||
|
||||
destructor TCEToolItem.destroy;
|
||||
begin
|
||||
fProcess.Free;
|
||||
inherited;
|
||||
end;
|
||||
|
||||
function TCEToolItem.getParameters: TStringList;
|
||||
begin
|
||||
result := fProcess.Parameters;
|
||||
end;
|
||||
|
||||
procedure TCEToolItem.setParameters(const aValue: TStringList);
|
||||
begin
|
||||
fProcess.Parameters.Assign(aValue);
|
||||
end;
|
||||
|
||||
procedure TCEToolItem.execute;
|
||||
begin
|
||||
|
||||
end;
|
||||
|
||||
constructor TCETools.create(itemClass: TCollectionItem) override;
|
||||
begin
|
||||
inherited create(itemClass);
|
||||
end;
|
||||
|
||||
function TCETools.getItem(index: Integer): TCEToolItem;
|
||||
begin
|
||||
exit(TCEToolItem(Items[index]));
|
||||
end;
|
||||
|
||||
end.
|
||||
|
|
@ -8,12 +8,12 @@ uses
|
|||
|
||||
|
||||
(**
|
||||
* Stops the server: e.g: to remove some bugy imports from the libman.
|
||||
* frees the server: e.g: to remove some bugy imports from the libman.
|
||||
*)
|
||||
procedure freeServer;
|
||||
|
||||
(**
|
||||
* Starts the server immediatly and not lazily.
|
||||
* recreates the server.
|
||||
*)
|
||||
procedure createServer;
|
||||
|
||||
|
|
|
@ -16,7 +16,6 @@ type
|
|||
|
||||
TCEMainForm = class;
|
||||
|
||||
//TODO-cfeature: switches -f<sourcefile.d>, -p<project.coedit>, -noplug
|
||||
//TODO-cfeature: options
|
||||
//TODO-cwidget: options editor
|
||||
(**
|
||||
|
@ -226,6 +225,7 @@ type
|
|||
fLibMan: TLibraryManager;
|
||||
|
||||
//Init - Fina
|
||||
procedure getCMdParams;
|
||||
procedure checkCompilo;
|
||||
procedure InitLibMan;
|
||||
procedure InitMRUs;
|
||||
|
@ -311,8 +311,9 @@ begin
|
|||
InitSettings;
|
||||
//
|
||||
newProj;
|
||||
InitPlugins;
|
||||
checkCompilo;
|
||||
getCMdParams;
|
||||
|
||||
end;
|
||||
|
||||
procedure TCEMainForm.checkCompilo;
|
||||
|
@ -326,6 +327,52 @@ begin
|
|||
close;
|
||||
end;
|
||||
|
||||
procedure TCEMainForm.getCMdParams;
|
||||
var
|
||||
value: string;
|
||||
str: TStringList;
|
||||
begin
|
||||
if application.ParamCount > 0 then
|
||||
begin
|
||||
value := application.Params[1];
|
||||
if value <> '' then
|
||||
begin
|
||||
str := TStringList.Create;
|
||||
try
|
||||
str.DelimitedText := value;
|
||||
for value in str do
|
||||
begin
|
||||
if fileExists(value) then
|
||||
openFile(value);
|
||||
end;
|
||||
finally
|
||||
str.Free;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
value := application.GetOptionValue('plugs');
|
||||
if value <> 'OFF' then
|
||||
InitPlugins;
|
||||
value := application.GetOptionValue('p', 'project');
|
||||
if (value <> '') and fileExists(value) then
|
||||
openProj(value);
|
||||
value := application.GetOptionValue('f', 'files');
|
||||
if value <> '' then
|
||||
begin
|
||||
str := TStringList.Create;
|
||||
try
|
||||
str.DelimitedText := value;
|
||||
for value in str do
|
||||
begin
|
||||
if fileExists(value) then
|
||||
openFile(value);
|
||||
end;
|
||||
finally
|
||||
str.Free;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TCEMainForm.InitLibMan;
|
||||
var
|
||||
fname: string;
|
||||
|
@ -1427,9 +1474,9 @@ label
|
|||
begin
|
||||
if fProject.currentConfiguration.outputOptions.binaryKind <> executable then
|
||||
begin
|
||||
// TODO:-cfeature: define an alternative exe name for shared lib:
|
||||
// TODO-cfeature: define an alternative exe name for shared lib:
|
||||
// e.g: the dll produced by the proj. is the input filename of an host app.
|
||||
dlgOkInfo('Non executable project cant be run');
|
||||
dlgOkInfo('Non executable projects cant be run');
|
||||
exit;
|
||||
end;
|
||||
if not fileExists(fProject.outputFilename) then
|
||||
|
|
Loading…
Reference in New Issue