allow to set a different root for source cache
authorStanislav Visnovsky <visnov@suse.cz>
Tue, 21 Feb 2006 11:41:07 +0000 (11:41 +0000)
committerStanislav Visnovsky <visnov@suse.cz>
Tue, 21 Feb 2006 11:41:07 +0000 (11:41 +0000)
zypp/SourceCache.cc
zypp/SourceCache.h

index b1105f2..cea7b0c 100644 (file)
@@ -19,6 +19,7 @@
 #include "zypp/source/Builtin.h"
 #include "zypp/media/MediaAccess.h"
 #include "zypp/SourceManager.h"
+#include "zypp/Pathname.h"
 
 using std::endl;
 using namespace zypp::source;
@@ -33,7 +34,7 @@ namespace zypp
   //   CLASS NAME : SourceCache
   //
   ///////////////////////////////////////////////////////////////////
-  const Pathname SourceCache::_cache_dir = "/var/adm/ZYPP/SourceCache";
+  Pathname SourceCache::_cache_dir = "/var/adm/ZYPP/SourceCache";
   unsigned SourceCache::_next_cache_id = 0;
 
   ///////////////////////////////////////////////////////////////////
@@ -51,6 +52,11 @@ namespace zypp
   //
   SourceCache::~SourceCache()
   {}
+  
+  void SourceCache::setCacheDir( const Pathname & dir_r )
+  {
+    _cache_dir = dir_r;
+  }
 
   void SourceCache::storeSource(Source_Ref src)
   {
index cf63e90..244b50e 100644 (file)
@@ -30,6 +30,8 @@ namespace zypp
   //
   //   CLASS NAME : SourceCache
   //
+  //   singleton
+  //
   class SourceCache
   {
     friend std::ostream & operator<<( std::ostream & str, const SourceCache & obj );
@@ -39,6 +41,8 @@ namespace zypp
     SourceCache();
     /** Dtor */
     ~SourceCache();
+    
+    void setCacheDir(const Pathname& dir_r);
 
   public:
     void storeSource(Source_Ref src);
@@ -51,7 +55,7 @@ namespace zypp
 
   private:
     /** directory to store cached data */
-    static const Pathname _cache_dir;
+    static Pathname _cache_dir;
     /** counter of caches */
     static unsigned _next_cache_id;