IDE: Allow to replace a path in PathEditor if a new path differs only by character case. Issue #33902.

git-svn-id: trunk@58815 -
This commit is contained in:
juha 2018-09-01 22:07:59 +00:00
parent a4a0be6cb0
commit 226118e3dd
2 changed files with 7 additions and 5 deletions

View File

@ -42,9 +42,9 @@ var
begin
for i:=0 to List.Count-1 do begin
case Cmp of
cstCaseSensitive: if List[i]=s then exit(i);
cstCaseSensitive: if List[i]=s then exit(i);
cstCaseInsensitive: if UTF8CompareText(List[i],s)=0 then exit(i);
cstFilename: if CompareFilenames(List[i],s)=0 then exit(i);
cstFilename: if CompareFilenames(List[i],s)=0 then exit(i);
end;
end;
Result:=-1;

View File

@ -30,7 +30,7 @@ uses
// LazControls
ShortPathEdit,
// IdeIntf
MacroIntf, IDEImagesIntf,
MacroIntf, IDEImagesIntf, IDEUtils,
// IDE
TransferMacros, GenericListSelect, LazarusIDEStrConsts;
@ -569,8 +569,10 @@ var
InValidPathsExist: Boolean;
begin
// Replace / add / delete / Delete Invalid Paths
AddButton.Enabled:=(DirectoryEdit.Text<>'') and (DirectoryEdit.Text<>FEffectiveBaseDirectory)
and (PathListBox.Items.IndexOf(BaseRelative(DirectoryEdit.Text))=-1);
AddButton.Enabled:=(DirectoryEdit.Text<>'')
and (DirectoryEdit.Text<>FEffectiveBaseDirectory)
and (IndexInStringList(PathListBox.Items,cstCaseSensitive,
BaseRelative(DirectoryEdit.Text)) = -1);
ReplaceButton.Enabled:=AddButton.Enabled and (PathListBox.ItemIndex>-1) ;
DeleteButton.Enabled:=PathListBox.SelCount=1; // or ItemIndex>-1; ?
// Delete non-existent paths button. Check if there are any.