From 611f6a74f8647098a8cf00939ac05a1a144a8880 Mon Sep 17 00:00:00 2001 From: Michael Andres Date: Wed, 30 Aug 2006 19:08:38 +0000 Subject: [PATCH] ScanSource: Fallback to Plaindir if autodetection fails --- devel/devel.ma/ScanSource.cc | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/devel/devel.ma/ScanSource.cc b/devel/devel.ma/ScanSource.cc index 22620e9..347f1ff 100644 --- a/devel/devel.ma/ScanSource.cc +++ b/devel/devel.ma/ScanSource.cc @@ -122,13 +122,33 @@ int main( int argc, char * argv[] ) Source_Ref src; try { - src = SourceFactory().createFrom( Url(*argv), "/", "" ); + Url url(*argv); + try + { + src = SourceFactory().createFrom( url, "/", "" ); + } + catch ( const Exception & except_r ) + { + static string unk( "Unknown source type" ); + if ( except_r.asString().substr( 0, unk.size() ) == unk ) + { + source::SourceInfo inf; + inf.setType( "Plaindir" ) + .setUrl( url ); + SEC << endl; + src = SourceFactory().createFrom( inf ); + SEC << src << endl; + } + else + throw; + } } catch ( const Exception & except_r ) { LOG << "***Failed: " << except_r << endl; continue; } + LOG << "type: " << src.type() << endl; LOG << "numberOfMedia: " << src.numberOfMedia() << endl; LOG << "alias: " << src.alias() << endl; LOG << "vendor: " << src.vendor() << endl; @@ -136,6 +156,7 @@ int main( int argc, char * argv[] ) LOG << "zmdName: " << src.zmdName() << endl; LOG << "zmdDescription: " << src.zmdDescription() << endl; LOG << "baseSource: " << src.baseSource() << endl; + LOG << "autorefresh: " << src.autorefresh() << endl; LOG << "publicKeys: " << src.publicKeys() << endl; LOG << "===Parse content..." << endl; -- 2.7.4