- isChangeable(MediaAccessId) added
authorJan Kupec <jkupec@suse.cz>
Fri, 27 Jul 2007 16:05:00 +0000 (16:05 +0000)
committerJan Kupec <jkupec@suse.cz>
Fri, 27 Jul 2007 16:05:00 +0000 (16:05 +0000)
zypp/media/MediaManager.cc
zypp/media/MediaManager.h

index 34ae9fe..d24f992 100644 (file)
@@ -776,6 +776,13 @@ namespace zypp
     }
 
     // ---------------------------------------------------------------
+    bool
+    MediaManager::isChangeable(MediaAccessId accessId)
+    {
+      return url(accessId).getScheme() == "cd" || url(accessId).getScheme() == "dvd";
+    }
+
+    // ---------------------------------------------------------------
     Pathname
     MediaManager::localRoot(MediaAccessId accessId) const
     {
index d9e5e3d..0a0a6e3 100644 (file)
@@ -667,6 +667,20 @@ namespace zypp
                      const MediaVerifierRef &verifier) const;
 
       /**
+       * Simple check, based on media's URL scheme, telling whether the
+       * it is possible to physically change the media inside its drive, like
+       * CDs or DVDs. Useful to decide whether to request media change from
+       * user or not. 
+       * 
+       * \param accessId The media access id.
+       * \return <tt>false</tt> if the media is not changeable,
+       *         <tt>true</tt> otherwise.
+       * \throws MediaNotOpenException for invalid access id.
+       */
+      bool
+      isChangeable(MediaAccessId accessId);
+
+      /**
        * Return the local directory that corresponds to medias url,
        * no matter if media isAttached or not. Files requested will
        * be available at 'localRoot() + filename' or even better