- is_changeable_media() added
authorJan Kupec <jkupec@suse.cz>
Thu, 30 Aug 2007 17:48:07 +0000 (17:48 +0000)
committerJan Kupec <jkupec@suse.cz>
Thu, 30 Aug 2007 17:48:07 +0000 (17:48 +0000)
src/zypper-utils.cc
src/zypper-utils.h

index b9dc33c..c22a5bf 100644 (file)
@@ -1,4 +1,7 @@
 #include <fstream>
+
+#include <zypp/media/MediaManager.h>
+
 #include "zypper.h"
 
 using namespace zypp::detail;
@@ -46,3 +49,11 @@ ostream& report_a_bug (ostream& stm)
     // unless you translate the actual page :)
              << _("See http://en.opensuse.org/Zypper#Troubleshooting for instructions.") << endl;
 }
+
+bool is_changeable_media(const zypp::Url & url)
+{
+  media::MediaManager mm; media::MediaAccessId id = mm.open(url);
+  bool is_cd = mm.isChangeable(id);
+  mm.close(id);
+  return is_cd;
+}
index 8a610ce..5a3f964 100644 (file)
@@ -5,6 +5,7 @@
 #include <string>
 
 #include <zypp/Pathname.h>
+#include <zypp/Url.h>
 
 std::string read_line_from_file( const zypp::Pathname &file );
 void write_line_to_file( const zypp::Pathname &file, const std::string &line );
@@ -14,4 +15,6 @@ void write_line_to_file( const zypp::Pathname &file, const std::string &line );
  */
 std::ostream & report_a_bug (std::ostream& stm);
 
+bool is_changeable_media(const zypp::Url & url);
+
 #endif /*ZYPPER_UTILS_H*/