From 6c5cf5e778ce7cce306b5e02c1ce66a536d3a11c Mon Sep 17 00:00:00 2001 From: andyq Date: Wed, 16 Oct 2002 21:24:23 +0000 Subject: Changed active server - found out you can have many (ipkg is so clever) Now active is set in server class. Also, currently ignores commented out servers in ipkg.conf --- (limited to 'noncore/settings/aqpkg/datamgr.cpp') diff --git a/noncore/settings/aqpkg/datamgr.cpp b/noncore/settings/aqpkg/datamgr.cpp index bb86766..7c49621 100644 --- a/noncore/settings/aqpkg/datamgr.cpp +++ b/noncore/settings/aqpkg/datamgr.cpp @@ -86,7 +86,7 @@ void DataManager :: loadServers() while ( fgets( line, sizeof line, fp) != NULL ) { lineStr = line; - if ( lineStr.startsWith( "src" ) || lineStr.startsWith( "#src" ) || lineStr.startsWith( "# src" ) ) + if ( lineStr.startsWith( "src" ) ) //|| lineStr.startsWith( "#src" ) || lineStr.startsWith( "# src" ) ) { char alias[20]; char url[100]; @@ -98,10 +98,13 @@ void DataManager :: loadServers() // Should Handle #src, # src, src, and combinations of sscanf( lineStr, "%*[^r]%*[^ ] %s %s", alias, url ); Server s( alias, url ); + if ( lineStr.startsWith( "src" ) ) + s.setActive( true ); + else + s.setActive( false ); + serverList.push_back( s ); - if ( lineStr.startsWith( "src" ) ) - setActiveServer( alias ); } else if ( lineStr.startsWith( "dest" ) ) { @@ -115,40 +118,6 @@ void DataManager :: loadServers() } fclose( fp ); - // Go through the server destination list and add root, cf and card if they - // don't already exist -/* AQ - commented out as if you don't have a CF or SD card in then - * this causes IPKG to try to create directories on non existant devices - * (which of course fails), gives a nasty error message and can cause ipkg - * to seg fault. - * - vector::iterator dit; - bool foundRoot = false; - bool foundCF = false; - bool foundCard = false; - for ( dit = destList.begin() ; dit != destList.end() ; ++dit ) - { - if ( dit->getDestinationPath() == "/" ) - foundRoot = true; - if ( dit->getDestinationPath() == "/mnt/cf" ) - foundCF = true; - if ( dit->getDestinationPath() == "/mnt/card" ) - foundCard = true; - } - - // If running on a Zaurus (arm) then if we didn't find root, CF or card - // destinations, add them as default -#ifdef QWS -#ifndef X86 - if ( !foundRoot ) - destList.push_back( Destination( "root", "/" ) ); - if ( !foundCF ) - destList.push_back( Destination( "cf", "/mnt/cf" ) ); - if ( !foundCF ) - destList.push_back( Destination( "card", "/mnt/card" ) ); -#endif -#endif -*/ vector::iterator it; for ( it = serverList.begin() ; it != serverList.end() ; ++it ) reloadServerData( it->getServerName() ); @@ -201,7 +170,7 @@ void DataManager :: writeOutIpkgConf() { QString url = it->getServerUrl();; - if ( !activeServer || alias != activeServer ) + if ( !it->isServerActive() ) out << "#"; out << "src " << alias << " " << url << endl; } -- cgit v0.9.0.2