From: Andrew Ruthven Date: Tue, 30 Sep 2008 01:37:31 +0000 (+1300) Subject: Check and make sure that F-Spot database exists before we try and access it. X-Git-Url: http://git.etc.gen.nz/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5a5e48b380b887e0399426ea8a4c0e9bc4719f8d;p=picture-display.git Check and make sure that F-Spot database exists before we try and access it. --- diff --git a/lib/Display/Plugins/Photo/FSpot.pm b/lib/Display/Plugins/Photo/FSpot.pm index b5c1fc3..9358a7e 100644 --- a/lib/Display/Plugins/Photo/FSpot.pm +++ b/lib/Display/Plugins/Photo/FSpot.pm @@ -2,6 +2,7 @@ package Display::Plugins::Photo::FSpot; use base ('Display::Plugins::Photo'); use Clutter; +use Carp; use POE; use POE::Component::EasyDBI; use strict; @@ -39,6 +40,13 @@ sub find_photo_result { sub init { my $self = shift; + my $db = $self->{'config'}{'_config'}{'plugins'}{'FSpot'}{'DB'} || $default_f_spot_db; + + if (! -f $db) { + carp "Can't find F-Spot database file: $db"; + return; + } + POE::Component::EasyDBI->spawn( alias => 'FSpotDB', dsn => "dbi:SQLite:dbname=" . ($self->{'config'}{'_config'}{'plugins'}{'FSpot'}{'DB'} || $default_f_spot_db),