Browse Source

* Issue a warning when a package-name is used twice

git-svn-id: trunk@22540 -
joost 13 years ago
parent
commit
b886d5d55c
1 changed files with 14 additions and 2 deletions
  1. 14 2
      packages/fpmkunit/src/fpmkunit.pp

+ 14 - 2
packages/fpmkunit/src/fpmkunit.pp

@@ -1315,6 +1315,7 @@ ResourceString
   SWarnCanNotSetAccessRights = 'Warning: Failed to copy access-rights to file %s';
   SWarnCanNotGetFileAge = 'Warning: Failed to get FileAge for %s';
   SWarnExtCommandNotFound = 'Warning: External command "%s" not found but "%s" is older then "%s"';
+  SWarnDuplicatePackage = 'Warning: Package %s is already added. Using the existing package';
 
   SInfoPackageAlreadyProcessed = 'Package %s is already processed';
   SInfoCompilingTarget    = 'Compiling target %s';
@@ -3355,9 +3356,20 @@ end;
 
 
 function TPackages.AddPackage(const AName: String): TPackage;
+var
+  i: integer;
 begin
-  Result:=Add as TPackage;
-  Result.Name:=AName;
+  i := IndexOfName(AName);
+  if i > -1 then
+    begin
+    result := PackageItems[i];
+    Installer.Log(vlWarning,Format(SWarnDuplicatePackage,[AName]))
+    end
+  else
+    begin
+    Result:=Add as TPackage;
+    Result.Name:=AName;
+    end;
 end;