Imported Upstream version 16.5.0
[platform/upstream/libzypp.git] / zypp / MediaSetAccess.cc
index 66bc72f..8ec5c65 100644 (file)
@@ -170,6 +170,20 @@ IMPL_PTR_TYPE(MediaSetAccess);
     return op.result;
   }
 
+  Pathname MediaSetAccess::provideOptionalFile( const Pathname & file, unsigned media_nr )
+  {
+    try
+    {
+      if ( doesFileExist( file, media_nr ) )
+       return provideFile( file, media_nr, PROVIDE_NON_INTERACTIVE );
+    }
+    catch ( const media::MediaFileNotFoundException & excpt_r )
+    { ZYPP_CAUGHT( excpt_r ); }
+    catch ( const media::MediaNotAFileException & excpt_r )
+    { ZYPP_CAUGHT( excpt_r ); }
+   return Pathname();
+  }
+
   bool MediaSetAccess::doesFileExist(const Pathname & file, unsigned media_nr )
   {
     ProvideFileExistenceOperation op;