aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Net/IMAP/Sync.pm
diff options
context:
space:
mode:
authorGuilhem Moulin <guilhem@fripost.org>2015-07-23 20:12:38 +0200
committerGuilhem Moulin <guilhem@fripost.org>2015-07-23 20:12:38 +0200
commitc7e3736d35527593235ae12bf6e879689ea17f66 (patch)
tree8d28a61e9b28af750797479a2a89997a1aa066c9 /lib/Net/IMAP/Sync.pm
parentb634b665a4a636460562ab0718770e0845da22a5 (diff)
Add a command-line option --config to specify the configuration file.
Diffstat (limited to 'lib/Net/IMAP/Sync.pm')
-rw-r--r--lib/Net/IMAP/Sync.pm3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/Net/IMAP/Sync.pm b/lib/Net/IMAP/Sync.pm
index 0228f29..61930e7 100644
--- a/lib/Net/IMAP/Sync.pm
+++ b/lib/Net/IMAP/Sync.pm
@@ -65,6 +65,9 @@ sub read_config($$%) {
my $section = shift;
my %opts = (%OPTIONS, @_);
+ $conffile = ($ENV{XDG_CONFIG_HOME} // "$ENV{HOME}/.config") .'/'. $conffile
+ unless $conffile =~ /\A\//; # relative path
+
die "No such config file $conffile\n"
unless defined $conffile and -f $conffile and -r $conffile;