Diffstat (limited to 'noncore/settings/packagemanager/oipkg.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/settings/packagemanager/oipkg.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/noncore/settings/packagemanager/oipkg.cpp b/noncore/settings/packagemanager/oipkg.cpp index 3d2c621..417ee95 100644 --- a/noncore/settings/packagemanager/oipkg.cpp +++ b/noncore/settings/packagemanager/oipkg.cpp @@ -234,26 +234,34 @@ void OIpkg::saveSettings() } } OPackageList *OIpkg::availablePackages( const QString &server ) { // Load Ipkg configuration info if not already cached if ( !m_confInfo ) loadConfiguration(); // Build new server list (caller is responsible for deleting) OPackageList *pl = new OPackageList; + // Get directory where server lists are located + QString listsDir; + OConfItem *confItem = findConfItem( OConfItem::Other, "lists_dir" ); + if ( confItem ) + listsDir = confItem->value(); + else + listsDir = IPKG_PKG_PATH; + // Open package list file - QFile f( IPKG_PKG_PATH + "/" + server ); + QFile f( listsDir + "/" + server ); if ( !f.open( IO_ReadOnly ) ) return NULL; QTextStream t( &f ); // Process all information in package list file OPackage *package = NULL; QString line = t.readLine(); while ( !t.eof() ) { // Determine key/value pair int pos = line.find( ':', 0 ); QString key; @@ -598,24 +606,28 @@ void OIpkg::loadConfiguration() } else if ( typeStr == "dest" ) type = OConfItem::Destination; else if ( typeStr == "option" ) type = OConfItem::Option; else if ( typeStr == "arch" ) type = OConfItem::Arch; else if ( typeStr == "lists_dir" ) { type = OConfItem::Other; features = name; name = typeStr; + + // Default value when not defined + if ( value == QString::null || value == "" ) + value = IPKG_PKG_PATH; } else recognizedOption = false; // Add to list if ( recognizedOption ) m_confInfo->append( new OConfItem( type, name, value, features, active ) ); } } f.close(); } |