From e67431e737e04e55fd7477b4903f5717dd860be6 Mon Sep 17 00:00:00 2001 From: Jan Kupec Date: Fri, 27 Jul 2007 16:05:00 +0000 Subject: [PATCH] - isChangeable(MediaAccessId) added --- zypp/media/MediaManager.cc | 7 +++++++ zypp/media/MediaManager.h | 14 ++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/zypp/media/MediaManager.cc b/zypp/media/MediaManager.cc index 34ae9fe..d24f992 100644 --- a/zypp/media/MediaManager.cc +++ b/zypp/media/MediaManager.cc @@ -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 { diff --git a/zypp/media/MediaManager.h b/zypp/media/MediaManager.h index d9e5e3d..0a0a6e3 100644 --- a/zypp/media/MediaManager.h +++ b/zypp/media/MediaManager.h @@ -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 false if the media is not changeable, + * true 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 -- 2.7.4