remove any invalid project from group after reloading

This commit is contained in:
Basile Burg 2016-07-07 07:57:08 +02:00
parent a6997859f0
commit 1be94f8095
2 changed files with 23 additions and 5 deletions

View File

@ -3075,11 +3075,9 @@ begin
fFreeProj := nil; fFreeProj := nil;
end; end;
// TODO-cFIleOpenDialog: allow multi selection when possible // TODO-cFileOpenDialog: allow multi selection when possible
//(open file, add file to project, ...) //(open file, add file to project, ...)
// TODO-cprojectgroup: handle invalid projects filename when reloading a group
procedure TCEMainForm.actProjGroupCompileExecute(Sender: TObject); procedure TCEMainForm.actProjGroupCompileExecute(Sender: TObject);
var var
i: integer; i: integer;

View File

@ -7,7 +7,8 @@ uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, ExtCtrls, Menus, Classes, SysUtils, FileUtil, Forms, Controls, Graphics, ExtCtrls, Menus,
Buttons, dialogs, ComCtrls, StdCtrls, Buttons, dialogs, ComCtrls, StdCtrls,
ce_widget, ce_common, ce_interfaces, ce_writableComponent, ce_observer, ce_widget, ce_common, ce_interfaces, ce_writableComponent, ce_observer,
ce_nativeproject, ce_dubproject, ce_projutils, ce_sharedres, ce_dsgncontrols; ce_nativeproject, ce_dubproject, ce_projutils, ce_sharedres, ce_dsgncontrols,
ce_dialogs;
type type
@ -219,9 +220,28 @@ begin
end; end;
procedure TProjectGroup.afterLoad; procedure TProjectGroup.afterLoad;
var
p: TProjectGroupItem;
i: integer;
b: boolean = false;
f: string = '';
begin begin
inherited; inherited;
fModified:=false; for i:= projectCount-1 downto 0 do
begin
p := item[i];
p.fGroup := self;
if not p.absoluteFilename.fileExists then
begin
f += LineEnding + '"' + p.absoluteFilename + '"';
fItems.Delete(i);
b := true;
end;
end;
fModified := b;
if b then
dlgOkError('the following projects are missing and are removed from the group:' + f,
'Project group error');
end; end;
procedure TProjectGroup.afterSave; procedure TProjectGroup.afterSave;