summaryrefslogtreecommitdiff
authortille <tille>2002-07-24 11:22:45 (UTC)
committer tille <tille>2002-07-24 11:22:45 (UTC)
commit0948a167e4e46e6d2082809ec47be6a08a5de9d7 (patch) (side-by-side diff)
tree31d9da85c68da2f2d4ca99a7ca3aaacce5ed72be
parent17068d35cc662a1cace883cfa98bb1f21534cb41 (diff)
downloadopie-0948a167e4e46e6d2082809ec47be6a08a5de9d7.zip
opie-0948a167e4e46e6d2082809ec47be6a08a5de9d7.tar.gz
opie-0948a167e4e46e6d2082809ec47be6a08a5de9d7.tar.bz2
fix #136 -- parse packagelist without a nl at eof
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/unsupported/oipkg/packagelist.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/noncore/unsupported/oipkg/packagelist.cpp b/noncore/unsupported/oipkg/packagelist.cpp
index 844f43f..998dae9 100644
--- a/noncore/unsupported/oipkg/packagelist.cpp
+++ b/noncore/unsupported/oipkg/packagelist.cpp
@@ -167,43 +167,54 @@ void PackageList::updateSections( Package* pack )
*subsecs += ss;
}
void PackageList::readFileEntries( QString filename, QString dest )
{
pvDebug(5,"PackageList::readFileEntries "+filename+" dest "+dest);
QStringList packEntry;
QFile f( filename );
if ( !f.open(IO_ReadOnly) ) return;
QTextStream *statusStream = new QTextStream( &f );
while ( !statusStream ->eof() )
- {
+ {
QString line = statusStream->readLine();
if ( line.find(QRegExp("[\n\t ]*")) || line == "" )
{
//end of package
if ( ! packEntry.isEmpty() )
{
Package *p = new Package( packEntry, settings );
if ( p )
{
p->setDest( dest );
insertPackage( p );
packEntry.clear();
}
}
}else{
packEntry << line;
};
}
+ //there might be no nl at the end of the package file
+ if ( ! packEntry.isEmpty() )
+ {
+ Package *p = new Package( packEntry, settings );
+ if ( p )
+ {
+ p->setDest( dest );
+ insertPackage( p );
+ packEntry.clear();
+ }
+ }
delete statusStream;
return;
}
void PackageList::setSettings( PackageManagerSettings *s )
{
settings = s;
}
Package* PackageList::getByName( QString n )
{
return origPackageList[n];