mirror of https://gitlab.com/basile.b/dexed.git
fix #168 - Dup entries in the library manager
This commit is contained in:
parent
a25aba3409
commit
1fd020978a
|
@ -118,6 +118,10 @@ type
|
||||||
* in "paths", as required by the specified "source" code.
|
* in "paths", as required by the specified "source" code.
|
||||||
*)
|
*)
|
||||||
procedure getLibsForSource(source, libs, paths: TStrings);
|
procedure getLibsForSource(source, libs, paths: TStrings);
|
||||||
|
(**
|
||||||
|
* The caller gets the "-I" (import) command line arguments in opts
|
||||||
|
* for the imports (as identifier chains) in "imports".
|
||||||
|
*)
|
||||||
procedure getLibFilesForImports(imports: TStrings; opts: TStrings);
|
procedure getLibFilesForImports(imports: TStrings; opts: TStrings);
|
||||||
//
|
//
|
||||||
procedure updateDCD;
|
procedure updateDCD;
|
||||||
|
|
|
@ -76,6 +76,7 @@ type
|
||||||
function itemForRow(row: TListItem): TLibraryItem;
|
function itemForRow(row: TListItem): TLibraryItem;
|
||||||
procedure RowToLibrary(row: TListItem; added: boolean = false);
|
procedure RowToLibrary(row: TListItem; added: boolean = false);
|
||||||
procedure dataToGrid;
|
procedure dataToGrid;
|
||||||
|
function isAliasRegistered(const anAlias: string): boolean;
|
||||||
protected
|
protected
|
||||||
procedure DoShow; override;
|
procedure DoShow; override;
|
||||||
public
|
public
|
||||||
|
@ -109,6 +110,13 @@ begin
|
||||||
btnEnabled.resourceName := 'BOOK_GREY';
|
btnEnabled.resourceName := 'BOOK_GREY';
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TCELibManEditorWidget.isAliasRegistered(const anAlias: string): boolean;
|
||||||
|
var
|
||||||
|
i: TListItem = nil;
|
||||||
|
begin
|
||||||
|
result := list.Items.findCaption(anAlias, i);
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TCELibManEditorWidget.projNew(project: ICECommonProject);
|
procedure TCELibManEditorWidget.projNew(project: ICECommonProject);
|
||||||
begin
|
begin
|
||||||
fProj := project;
|
fProj := project;
|
||||||
|
@ -408,11 +416,13 @@ var
|
||||||
begin
|
begin
|
||||||
if TDubPackageQueryForm.showAndWait(nme, ver) <> mrOk then
|
if TDubPackageQueryForm.showAndWait(nme, ver) <> mrOk then
|
||||||
exit;
|
exit;
|
||||||
if List.Items.findCaption(nme, row) then
|
if isAliasRegistered(nme) then
|
||||||
begin
|
begin
|
||||||
if dlgYesNo(format('a library item with the alias "%s" already exists, do you wish to update it ?',
|
if dlgYesNo(format('a library item with the alias "%s" already exists, do you wish to update it ?',
|
||||||
[nme])) <> mrYes then exit
|
[nme])) <> mrYes then
|
||||||
else ovw := true;
|
exit
|
||||||
|
else
|
||||||
|
ovw := true;
|
||||||
end;
|
end;
|
||||||
{$IFDEF WINDOWS}
|
{$IFDEF WINDOWS}
|
||||||
pth := GetEnvironmentVariable('APPDATA') + '\dub\packages\' + nme + '-' + ver;
|
pth := GetEnvironmentVariable('APPDATA') + '\dub\packages\' + nme + '-' + ver;
|
||||||
|
@ -650,9 +660,9 @@ begin
|
||||||
if fProj = nil then
|
if fProj = nil then
|
||||||
exit;
|
exit;
|
||||||
|
|
||||||
fname := fProj.filename;
|
fname := fProj.outputFilename;
|
||||||
lalias := ExtractFileNameOnly(fname);
|
lalias := ExtractFileNameOnly(fname);
|
||||||
if List.Items.findCaption(lalias, row) then
|
if isAliasRegistered(lalias) then
|
||||||
begin
|
begin
|
||||||
dlgOkInfo(format('a library item with the alias "%s" already exists, delete it before trying again.',
|
dlgOkInfo(format('a library item with the alias "%s" already exists, delete it before trying again.',
|
||||||
[lalias]));
|
[lalias]));
|
||||||
|
@ -668,10 +678,9 @@ begin
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
fname := fProj.outputFilename;
|
|
||||||
row := List.Items.Add;
|
row := List.Items.Add;
|
||||||
row.Data := LibMan.libraries.Add;
|
row.Data := LibMan.libraries.Add;
|
||||||
row.Caption := ExtractFileNameOnly(fname);
|
row.Caption := lalias;
|
||||||
if fname.extractFileExt <> libExt then
|
if fname.extractFileExt <> libExt then
|
||||||
row.SubItems.add(fname + libExt)
|
row.SubItems.add(fname + libExt)
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue