00001
00002
00003
00004
00005
00006
00007
00008
00013 #include <iostream>
00014
00015 #include "zypp/base/Logger.h"
00016 #include "zypp/media/MediaDIR.h"
00017
00018 #include <sys/mount.h>
00019 #include <errno.h>
00020
00021 using namespace std;
00022
00023 namespace zypp {
00024 namespace media {
00025
00027
00028
00029
00031
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042 MediaDIR::MediaDIR( const Url & url_r,
00043 const Pathname & )
00044 : MediaHandler( url_r, url_r.getPathName(),
00045 "/",
00046 false )
00047 {
00048 MIL << "MediaDIR::MediaDIR(" << url_r << ")" << endl;
00049 if( !url_r.getHost().empty())
00050 {
00051 ZYPP_THROW(MediaBadUrlException(url_r,
00052 "Hostname not allowed in the Url"
00053 ));
00054 }
00055 }
00056
00058
00059
00060
00061
00062
00063
00064
00065 void MediaDIR::attachTo(bool next)
00066 {
00067 if(next)
00068 ZYPP_THROW(MediaNotSupportedException(url()));
00069
00070
00071 if(attachPoint().empty() || !PathInfo(attachPoint()).isDir())
00072 {
00073 ZYPP_THROW(MediaBadUrlException(url(),
00074 "Specified path '" + attachPoint().asString() + "' is not allowed as media source"
00075 ));
00076 }
00077
00078 MediaSourceRef media(new MediaSource("dir", attachPoint().asString()));
00079 setMediaSource(media);
00080 }
00081
00082
00084
00085
00086
00087
00088
00089
00090
00091 void MediaDIR::releaseFrom( bool eject )
00092 {
00093 return;
00094 }
00095
00097
00098
00099
00100
00101
00102
00103
00104 void MediaDIR::getFile( const Pathname & filename ) const
00105 {
00106 MediaHandler::getFile( filename );
00107 }
00108
00110
00111
00112
00113
00114
00115
00116 void MediaDIR::getDir( const Pathname & dirname, bool recurse_r ) const
00117 {
00118 MediaHandler::getDir( dirname, recurse_r );
00119 }
00120
00122
00123
00124
00125
00126
00127
00128
00129 void MediaDIR::getDirInfo( std::list<std::string> & retlist,
00130 const Pathname & dirname, bool dots ) const
00131 {
00132 MediaHandler::getDirInfo( retlist, dirname, dots );
00133 }
00134
00136
00137
00138
00139
00140
00141
00142
00143 void MediaDIR::getDirInfo( filesystem::DirContent & retlist,
00144 const Pathname & dirname, bool dots ) const
00145 {
00146 MediaHandler::getDirInfo( retlist, dirname, dots );
00147 }
00148
00149 }
00150 }