]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/deb/debindexfile.cc
* fix for output of the description and the debTranslationsIndex::Exists()
[apt.git] / apt-pkg / deb / debindexfile.cc
index 4113137eb921c6da4f4d13dcb2bff51df3a184fe..ffecbdfca2d73ffccce0ceca293bd8d088c2c349 100644 (file)
@@ -406,7 +406,7 @@ string debTranslationsIndex::Info(const char *Type) const
 /* */
 bool debTranslationsIndex::Exists() const
 {
-   return true;
+   return FileExists(IndexFile(LanguageCode().c_str()));
 }
                                                                        /*}}}*/
 // TranslationsIndex::Size - Return the size of the index              /*{{{*/
@@ -453,7 +453,29 @@ bool debTranslationsIndex::Merge(pkgCacheGenerator &Gen,OpProgress &Prog) const
    return true;
 }
                                                                        /*}}}*/
+// TranslationsIndex::FindInCache - Find this index                            /*{{{*/
+// ---------------------------------------------------------------------
+/* */
+pkgCache::PkgFileIterator debTranslationsIndex::FindInCache(pkgCache &Cache) const
+{
+   string FileName = TranslationFile();
 
+   pkgCache::PkgFileIterator File = Cache.FileBegin();
+   for (; File.end() == false; File++)
+   {
+      if (FileName != File.FileName())
+        continue;
+      
+      struct stat St;
+      if (stat(File.FileName(),&St) != 0)
+        return pkgCache::PkgFileIterator(Cache);
+      if ((unsigned)St.st_size != File->Size || St.st_mtime != File->mtime)
+        return pkgCache::PkgFileIterator(Cache);
+      return File;
+   }   
+   return File;
+}
+                                                                       /*}}}*/
 // StatusIndex::debStatusIndex - Constructor                           /*{{{*/
 // ---------------------------------------------------------------------
 /* */