瀏覽代碼

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

git-svn-id: trunk@22540 -
joost 13 年之前
父節點
當前提交
b886d5d55c
共有 1 個文件被更改,包括 14 次插入2 次删除
  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;