]> git.etc.gen.nz Git - picture-display.git/commitdiff
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 b5c1fc322ca0b5c3a17a94d72088dbd448f76a7c..9358a7ecbb99f9ca963513d1af8658667be85ea2 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),