mirror of https://gitlab.com/basile.b/dexed.git
added some verifications before running a proj
This commit is contained in:
parent
911aee8a21
commit
e4186748fc
|
@ -1330,18 +1330,7 @@ begin
|
||||||
try
|
try
|
||||||
aProject.currentConfiguration.runOptions.setProcess(runProc);
|
aProject.currentConfiguration.runOptions.setProcess(runProc);
|
||||||
runproc.Parameters.AddText(runArgs);
|
runproc.Parameters.AddText(runArgs);
|
||||||
procname := aProject.currentConfiguration.pathsOptions.outputFilename;
|
procname := aProject.outputFilename;
|
||||||
if procname <> '' then procname := aProject.getAbsoluteFilename(procname)
|
|
||||||
else if aProject.Sources.Count > 0 then
|
|
||||||
begin
|
|
||||||
procname := extractFilename(aProject.Sources.Strings[0]);
|
|
||||||
procname := procname[1..length(procname)-2];
|
|
||||||
procname := extractFilePath(aProject.fileName) +
|
|
||||||
DirectorySeparator + procname;
|
|
||||||
{$IFDEF MSWINDOWS}
|
|
||||||
procname += '.exe';
|
|
||||||
{$ENDIF}
|
|
||||||
end;
|
|
||||||
|
|
||||||
if not fileExists(procname) then
|
if not fileExists(procname) then
|
||||||
begin
|
begin
|
||||||
|
@ -1423,7 +1412,40 @@ begin
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCEMainForm.actProjRunExecute(Sender: TObject);
|
procedure TCEMainForm.actProjRunExecute(Sender: TObject);
|
||||||
|
var
|
||||||
|
i: Integer;
|
||||||
|
dt: double;
|
||||||
|
label
|
||||||
|
_rbld,
|
||||||
|
_run;
|
||||||
begin
|
begin
|
||||||
|
if fProject.currentConfiguration.outputOptions.binaryKind <> executable then
|
||||||
|
begin
|
||||||
|
// 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');
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
if not fileExists(fProject.outputFilename) then
|
||||||
|
begin
|
||||||
|
if dlgOkCancel('The project output is missing, build ?') <> mrOK then
|
||||||
|
exit;
|
||||||
|
goto _rbld;
|
||||||
|
end;
|
||||||
|
dt := fileAge(fProject.outputFilename);
|
||||||
|
for i := 0 to fProject.Sources.Count-1 do
|
||||||
|
begin
|
||||||
|
if fileAge(fProject.getAbsoluteSourceName(i)) > dt then
|
||||||
|
if dlgOkCancel('The project sources have changed since last build, rebuild ?') = mrOK then
|
||||||
|
goto _rbld
|
||||||
|
else
|
||||||
|
break;
|
||||||
|
end;
|
||||||
|
goto _run;
|
||||||
|
_rbld:
|
||||||
|
compileProject(fProject);
|
||||||
|
_run:
|
||||||
|
if fileExists(fProject.outputFilename) then
|
||||||
runProject(fProject);
|
runProject(fProject);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
|
@ -61,6 +61,7 @@ type
|
||||||
procedure getOpts(const aList: TStrings);
|
procedure getOpts(const aList: TStrings);
|
||||||
procedure saveToFile(const aFilename: string);
|
procedure saveToFile(const aFilename: string);
|
||||||
procedure loadFromFile(const aFilename: string);
|
procedure loadFromFile(const aFilename: string);
|
||||||
|
function outputFilename: string;
|
||||||
//
|
//
|
||||||
property libraryManager: TLibraryManager read fLibMan write fLibMan;
|
property libraryManager: TLibraryManager read fLibMan write fLibMan;
|
||||||
property configuration[ix: integer]: TCompilerConfiguration read getConfig;
|
property configuration[ix: integer]: TCompilerConfiguration read getConfig;
|
||||||
|
@ -269,6 +270,23 @@ begin
|
||||||
fModified := false;
|
fModified := false;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TCEProject.outputFilename: string;
|
||||||
|
begin
|
||||||
|
result := currentConfiguration.pathsOptions.outputFilename;
|
||||||
|
if result <> '' then
|
||||||
|
begin
|
||||||
|
if not fileExists(result) then
|
||||||
|
result := getAbsoluteFilename(result);
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
result := extractFilename(Sources.Strings[0]);
|
||||||
|
result := result[1..length(result) - length(extractFileExt(result))];
|
||||||
|
result := extractFilePath(fileName) + DirectorySeparator + result;
|
||||||
|
{$IFDEF MSWINDOWS}
|
||||||
|
result += '.exe';
|
||||||
|
{$ENDIF}
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TCEProject.getOpts(const aList: TStrings);
|
procedure TCEProject.getOpts(const aList: TStrings);
|
||||||
var
|
var
|
||||||
rel, abs: string;
|
rel, abs: string;
|
||||||
|
|
Loading…
Reference in New Issue