summaryrefslogtreecommitdiff
path: root/cmdline/apt-cdrom.cc
diff options
context:
space:
mode:
authorArch Librarian <arch@canonical.com>2004-09-20 16:53:26 +0000
committerArch Librarian <arch@canonical.com>2004-09-20 16:53:26 +0000
commit22177db995b8c95af5db5d8ca74821dc79373b3a (patch)
tree0ab917b4d35867e3f97949ac98e949afce9977e3 /cmdline/apt-cdrom.cc
parent3782b88d989bd3895bcf53797c1ec8bfc163efe6 (diff)
Made it search for the .disk directory too
Author: jgg Date: 1999-04-07 05:57:04 GMT Made it search for the .disk directory too
Diffstat (limited to 'cmdline/apt-cdrom.cc')
-rw-r--r--cmdline/apt-cdrom.cc22
1 files changed, 16 insertions, 6 deletions
diff --git a/cmdline/apt-cdrom.cc b/cmdline/apt-cdrom.cc
index cac0f7eff..fdd12ebde 100644
--- a/cmdline/apt-cdrom.cc
+++ b/cmdline/apt-cdrom.cc
@@ -1,6 +1,6 @@
// -*- 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.
@@ -38,7 +38,8 @@
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)
@@ -63,6 +64,13 @@ bool FindPackages(string CD,vector<string> &List, unsigned int Depth = 0)
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());
@@ -97,7 +105,7 @@ bool FindPackages(string CD,vector<string> &List, unsigned int Depth = 0)
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)
@@ -852,7 +860,8 @@ bool DoAdd(CommandLine &)
// 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;
@@ -883,9 +892,10 @@ bool DoAdd(CommandLine &)
_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);