- Files[I->ID].File = new FileFd(I.FileName(),FileFd::ReadOnly);
- if (_error->PendingError() == true)
- return;
- Files[I->ID].Parse = new debRecordParser(*Files[I->ID].File);
- if (_error->PendingError() == true)
- return;
- }
+ const pkgIndexFile::Type *Type = pkgIndexFile::Type::GetType(I.IndexType());
+ if (Type == 0)
+ {
+ _error->Error(_("Index file type '%s' is not supported"),I.IndexType());
+ return;
+ }
+
+ Files[I->ID] = Type->CreatePkgParser(I);
+ if (Files[I->ID] == 0)
+ return;
+ }