#!/usr/bin/perl -w
use strict;
-# * Copyright 2002 Paul Mangan <claws@thewildbeast.co.uk>
+# * Copyright 2002 Paul Mangan <paul@claws-mail.org>
# *
# * Reimplemented by Torsten Schoenfeld <kaffeetisch@web.de>
# *
# * This file is free software; you can redistribute it and/or modify it
# * under the terms of the GNU General Public License as published by
-# * the Free Software Foundation; either version 2 of the License, or
+# * the Free Software Foundation; either version 3 of the License, or
# * (at your option) any later version.
# *
# * This program is distributed in the hope that it will be useful, but
# *
# * You should have received a copy of the GNU General Public License
# * along with this program; if not, write to the Free Software
-# * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+# * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
# *
-chdir($ENV{ HOME } . "/.sylpheed") or die("You don't appear to have Sylpheed installed\n");
+my $old_config_dir = "$ENV{HOME}/.sylpheed";
+my $config_dir = `claws-mail --config-dir`;
+chomp $config_dir;
+
+chdir($ENV{ HOME } . "/$config_dir")
+ or die("You don't appear to have Claws Mail installed\n");
###############################################################################
my $mailbox;
-open(FOLDERLIST, "<folderlist.xml") or die("Can't find 'folderlist.xml'\n");
+open(FOLDERLIST, "<$old_config_dir/folderlist.xml")
+ or die("Can't find '$old_config_dir/folderlist.xml'\n");
while (<FOLDERLIST>) {
if (m/<folder type="mh" name="([^"]+)" path="[^"]+"/) {
$mailbox = $1;
###############################################################################
-open(FILTERRC, "<filterrc") or die("Can't find your old filter rules ('filterrc')\n");
+open(FILTERRC, "<$old_config_dir/filterrc")
+ or die("Can't find your old filter rules ('$old_config_dir/filterrc')\n");
while (<FILTERRC>) {
chomp();
print MATCHERRC @new_filters;
close(MATCHERRC);
-rename("filterrc", "filterrc.old");
+print "Converted $#new_filters filters\n";
+if ($old_config_dir eq $config_dir) {
+ rename("filterrc", "filterrc.old");
+ print "Renamed your old filter rules ('filterrc' to 'filterrc.old')\n";
+}
###############################################################################
-print "Converted $#new_filters filters\n";
-print "Renamed your old filter rules ('filterrc' to 'filterrc.old')\n";