Check and make sure that F-Spot database exists before we try and access it.
authorAndrew Ruthven <puck@catalyst.net.nz>
Tue, 30 Sep 2008 01:37:31 +0000 (14:37 +1300)
committerAndrew Ruthven <puck@dirk.wgtn.cat-it.co.nz>
Tue, 30 Sep 2008 01:37:31 +0000 (14:37 +1300)
lib/Display/Plugins/Photo/FSpot.pm

index b5c1fc3..9358a7e 100644 (file)
@@ -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),