// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: apt-cdrom.cc,v 1.20 1999/04/03 01:05:25 jgg Exp $
+// $Id: apt-cdrom.cc,v 1.21 1999/04/07 05:57:04 jgg Exp $
/* ######################################################################
APT CDROM - Tool for handling APT's CDROM database.
search that short circuits when it his a package file in the dir.
This speeds it up greatly as the majority of the size is in the
binary-* sub dirs. */
-bool FindPackages(string CD,vector<string> &List, unsigned int Depth = 0)
+bool FindPackages(string CD,vector<string> &List,string &InfoDir,
+ unsigned int Depth = 0)
{
static ino_t Inodes[9];
if (Depth >= 7)
return true;
}
+ // Look for a .disk subdirectory
+ if (stat(".disk",&Buf) == 0)
+ {
+ if (InfoDir.empty() == true)
+ InfoDir = CD + ".disk/";
+ }
+
DIR *D = opendir(".");
if (D == 0)
return _error->Errno("opendir","Unable to read %s",CD.c_str());
Inodes[Depth] = Buf.st_ino;
// Descend
- if (FindPackages(CD + Dir->d_name,List,Depth+1) == false)
+ if (FindPackages(CD + Dir->d_name,List,InfoDir,Depth+1) == false)
break;
if (chdir(CD.c_str()) != 0)
// Get the CD structure
vector<string> List;
string StartDir = SafeGetCWD();
- if (FindPackages(CDROM,List) == false)
+ string InfoDir;
+ if (FindPackages(CDROM,List,InfoDir) == false)
{
cout << endl;
return false;
_config->FindB("APT::CDROM::Rename",false) == true)
{
// Try to use the CDs label if at all possible
- if (FileExists(CDROM + "/.disk/info") == true)
+ if (InfoDir.empty() == false &&
+ FileExists(CDROM + InfoDir + "/info") == true)
{
- ifstream F(string(CDROM+ "/.disk/info").c_str());
+ ifstream F(string(CDROM + InfoDir + "/info").c_str());
if (!F == 0)
getline(F,Name);