ide: create new unique unit name: check disk files

This commit is contained in:
mattias 2025-03-16 11:10:28 +01:00
parent 547f5dd88d
commit 435a011e8a

View File

@ -6303,6 +6303,8 @@ function TMainIDE.CreateNewUniqueFilename(const Prefix, Ext: string;
NewOwner: TObject; Flags: TSearchIDEFileFlags; TryWithoutNumber: boolean): string;
function FileIsUnique(const ShortFilename: string): boolean;
var
aUnitName, InFilename: String;
begin
Result:=false;
@ -6324,6 +6326,14 @@ function TMainIDE.CreateNewUniqueFilename(const Prefix, Ext: string;
if (siffCheckAllProjects in Flags) then begin
end;
// search in project unit path
if FilenameIsPascalUnit(ShortFilename) then begin
aUnitName:=ExtractFileNameOnly(ShortFilename);
InFilename:='';
if CodeToolBoss.DirectoryCachePool.FindUnitSourceInCompletePath(Project1.Directory,
aUnitName,InFilename,true)<>'' then exit;
end;
Result:=true;
end;