fix pruning deleted files
[id3fs.git] / bin / id3fs-index
index af8fee3..88959f7 100755 (executable)
@@ -88,7 +88,10 @@ sub wanted
 sub prune
 {
     my $dir=shift;
+    $dir=Cwd::abs_path($dir);
     return unless(opendir(DIR, $dir));
+    my $base=Cwd::abs_path($db->base_dir());
+    $dir=~s/^$base\/?//;
     my @oldfiles=$db->files_in($dir);
     my @newfiles=grep { !/^\.\.?$/; } readdir(DIR);
     closedir(DIR);
@@ -100,9 +103,8 @@ sub prune
     {
        unless(exists($hash{$file}))
        {
-           # FIXME: add path, rebasify
            $files_pruned=1;
-           $db->unindex($file);
+           $db->unindex($dir, $file);
        }
     }
 }