ide: use RemoveAmpersands

This commit is contained in:
mattias 2025-01-24 16:47:19 +01:00
parent 85dd5c0743
commit 5661bb7120
2 changed files with 5 additions and 7 deletions

View File

@ -713,9 +713,7 @@ resourcestring
lisReplacementFuncs = 'Replacement functions';
lisFilesHaveRightEncoding = '*** All found files already have the right encoding ***';
lisEncodingNumberOfFilesFailed = 'Number of files failed to convert: %d';
//
lisnoname = 'noname';
lisnoname = 'noname'; // default unit name, must be a valid identifier
lisTheDestinationDirectoryDoesNotExist = 'The destination directory%s"%s" does not exist.';
lisRenameFile = 'Rename file?';
lisThisLooksLikeAPascalFileItIsRecommendedToUseLowerC = 'This looks like a Pascal file.'

View File

@ -4930,7 +4930,7 @@ begin
OldUnitName:='';
//debugln('ShowSaveFileAsDialog sourceunitname=',OldUnitName);
if sfskipReferences in Flags then
SaveAsFilename:=LowerCase(StringReplace(OldUnitName,'&','',[rfReplaceAll]))
SaveAsFilename:=LowerCase(RemoveAmpersands(OldUnitName))
else
SaveAsFilename:=OldUnitName;
if SaveAsFilename='' then
@ -8221,17 +8221,17 @@ begin
if Assigned(Project1.MainUnitInfo) then begin
NewProgramName := Project1.MainUnitInfo.ReadUnitNameFromSource(false);
ANewPath := ExtractFilePath(Project1.MainUnitInfo.Filename);
AFileName := StringReplace(NewProgramName,'&','',[rfReplaceAll]);
AFileName := RemoveAmpersands(NewProgramName);
end;
if AFilename = '' then begin
NewProgramName := ExtractFileName(Project1.ProjectInfoFile);
ANewPath := ExtractFilePath(Project1.ProjectInfoFile);
AFilename := StringReplace(NewProgramName,'&','',[rfReplaceAll]);
AFilename := RemoveAmpersands(NewProgramName);
end;
if AFilename = '' then begin
NewProgramName := Trim(Project1.GetTitle);
ANewPath := Project1.Directory;
AFilename := StringReplace(NewProgramName,'&','',[rfReplaceAll]);
AFilename := RemoveAmpersands(NewProgramName);
end;
if AFilename = '' then begin
NewProgramName := 'Project1';