diff --git a/components/projectgroups/projectgroup.pp b/components/projectgroups/projectgroup.pp index 6ca00f6730..f5a21dc0b9 100644 --- a/components/projectgroups/projectgroup.pp +++ b/components/projectgroups/projectgroup.pp @@ -1733,9 +1733,10 @@ begin // load list of RequiredPackages from lpi Path:='ProjectOptions/RequiredPackages/'; - Cnt:=xml.GetValue(Path+'Count',0); - for i:=1 to Cnt do begin - SubPath:=Path+'Item'+IntToStr(i)+'/'; + LegacyList:=(ALPIFileVersion<=11) or xml.IsLegacyList(Path); + Cnt:=xml.GetListItemCount(Path, 'Item', LegacyList); + for i:=0 to Cnt-1 do begin + SubPath:=Path+xml.GetListItemXPath('Item', i, LegacyList, True)+'/'; PkgName:=xml.GetValue(SubPath+'PackageName/Value',''); if PkgName='' then continue; FRequiredPackages.Add(TPGDependency.Create(Self,PkgName)); diff --git a/ide/project.pp b/ide/project.pp index ee22d4e2a3..7eccc02846 100644 --- a/ide/project.pp +++ b/ide/project.pp @@ -3280,7 +3280,7 @@ begin RunParameterOptions.Save(FXMLConfig,Path+'RunParams/',fCurStorePathDelim,rpsLPI, UseLegacyLists); // save dependencies SavePkgDependencyList(FXMLConfig,Path+'RequiredPackages/', - FFirstRequiredDependency,pdlRequires,fCurStorePathDelim); + FFirstRequiredDependency,pdlRequires,fCurStorePathDelim,pfCompatibilityMode in FFlags); // save units SaveUnits(Path,FSaveSessionInLPI); diff --git a/packager/packagedefs.pas b/packager/packagedefs.pas index 745c5533c0..fb53c36328 100644 --- a/packager/packagedefs.pas +++ b/packager/packagedefs.pas @@ -831,7 +831,7 @@ procedure LoadPkgDependencyList(XMLConfig: TXMLConfig; const ThePath: string; HoldPackages, SortList: boolean); procedure SavePkgDependencyList(XMLConfig: TXMLConfig; const ThePath: string; First: TPkgDependency; ListType: TPkgDependencyList; - UsePathDelim: TPathDelimSwitch); + UsePathDelim: TPathDelimSwitch;LegacyLists:Boolean); procedure ListPkgIDToDependencyList(ListOfTLazPackageID: TObjectList; var First: TPkgDependency; ListType: TPkgDependencyList; Owner: TObject; HoldPackages: boolean); @@ -945,14 +945,17 @@ var List: TFPList; FileVersion: Integer; Last: TPkgDependency; + LegacyList: Boolean; + SubPath: string; begin FileVersion:=XMLConfig.GetValue(ThePath+'Version',0); - NewCount:=XMLConfig.GetValue(ThePath+'Count',0); + LegacyList:=XMLConfig.IsLegacyList(ThePath); + NewCount:=XMLConfig.GetListItemCount(ThePath, 'Item', LegacyList); List:=TFPList.Create; for i:=0 to NewCount-1 do begin PkgDependency:=TPkgDependency.Create; - PkgDependency.LoadFromXMLConfig(XMLConfig,ThePath+'Item'+IntToStr(i+1)+'/', - FileVersion); + SubPath:=ThePath+XMLConfig.GetListItemXPath('Item', i, LegacyList, True)+'/'; + PkgDependency.LoadFromXMLConfig(XMLConfig,SubPath,FileVersion); PkgDependency.HoldPackage:=HoldPackages; // IsMakingSense checks if the package-name is a valid identifier. This is // not applicable to FPMake-packages. @@ -979,19 +982,21 @@ end; procedure SavePkgDependencyList(XMLConfig: TXMLConfig; const ThePath: string; First: TPkgDependency; ListType: TPkgDependencyList; - UsePathDelim: TPathDelimSwitch); + UsePathDelim: TPathDelimSwitch; LegacyLists: Boolean); var i: Integer; Dependency: TPkgDependency; + SubPath: string; begin i:=0; Dependency:=First; while Dependency<>nil do begin - inc(i); - Dependency.SaveToXMLConfig(XMLConfig,ThePath+'Item'+IntToStr(i)+'/',UsePathDelim); + SubPath:=ThePath+XMLConfig.GetListItemXPath('Item', i, LegacyLists, True)+'/'; + Dependency.SaveToXMLConfig(XMLConfig,SubPath,UsePathDelim); Dependency:=Dependency.NextDependency[ListType]; + inc(i); end; - XMLConfig.SetDeleteValue(ThePath+'Count',i,0); + XMLConfig.SetListItemCount(ThePath, i, LegacyLists); end; procedure ListPkgIDToDependencyList(ListOfTLazPackageID: TObjectList; @@ -2963,7 +2968,7 @@ begin XMLConfig.SetDeleteValue(Path+'i18n/EnableI18NForLFM/Value', EnableI18NForLFM, false); SavePkgDependencyList(XMLConfig,Path+'RequiredPkgs/', - FFirstRequiredDependency,pdlRequires,UsePathDelim); + FFirstRequiredDependency,pdlRequires,UsePathDelim,True); FUsageOptions.SaveToXMLConfig(XMLConfig,Path+'UsageOptions/',UsePathDelim); fPublishOptions.SaveToXMLConfig(XMLConfig,Path+'PublishOptions/',UsePathDelim); SaveStringList(XMLConfig,FProvides,Path+'Provides/');