From d9bb30f2f56c8b3f7f7579eb1a5b96c4c53695ea Mon Sep 17 00:00:00 2001 From: Basile Burg Date: Thu, 14 Apr 2016 22:48:04 +0200 Subject: [PATCH] libman editor, dub, allow to re-fetch without explicit removal of an item --- src/ce_libmaneditor.pas | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/ce_libmaneditor.pas b/src/ce_libmaneditor.pas index 76a22ae6..0ffcc624 100644 --- a/src/ce_libmaneditor.pas +++ b/src/ce_libmaneditor.pas @@ -294,15 +294,16 @@ var idx: integer; prj: TCEDubProject; upd: boolean = false; - row: TListItem; + ovw: boolean = false; + row: TListItem = nil; begin if TDubPackageQueryForm.showAndWait(nme) <> mrOk then exit; if List.Items.FindCaption(0, nme, false, false, false).isNotNil then begin - dlgOkInfo(format('a library item with the alias "%s" already exists, delete it before trying again.', - [nme])); - exit; + if dlgYesNo(format('a library item with the alias "%s" already exists, do you wish to update it ?', + [nme])) <> mrYes then exit + else ovw := true; end; {$IFDEF WINDOWS} pth := GetEnvironmentVariable('APPDATA') + '\dub\packages\' + nme + '-master'; @@ -362,6 +363,7 @@ begin dub.Options:= [poUsePipes, poStderrToOutPut]; dub.Parameters.Add('build'); dub.Parameters.Add('--build=release'); + dub.Parameters.Add('--force'); dub.CurrentDirectory:= pth; dub.Execute; while dub.Running do sleep(10); @@ -397,7 +399,10 @@ begin try for idx := 0 to prj.sourcesCount-1 do str.Add(prj.sourceAbsolute(idx)); - row := List.Items.Add; + if ovw then + row := List.FindCaption(0, nme, true, true, true); + if row.isNil then + row := List.Items.Add; row.Data := LibMan.libraries.Add; row.Caption := nme; row.SubItems.Add(prj.outputFilename);