lib/PublicInbox/LeiOverview.pm | 6 ++---- lib/PublicInbox/LeiToMail.pm | 4 ++-- t/lei.t | 2 +- diff --git a/lib/PublicInbox/LeiOverview.pm b/lib/PublicInbox/LeiOverview.pm index dcc3088ba8f35e4b45fdf8eefffbb8b6c6f5bb51..cab2b055a5969347d0b55b64db155c7174342baa 100644 --- a/lib/PublicInbox/LeiOverview.pm +++ b/lib/PublicInbox/LeiOverview.pm @@ -42,12 +42,10 @@ sub detect_fmt ($$) { my ($lei, $dst) = @_; if ($dst =~ m!\A([:/]+://)!) { $lei->fail("$1 support not implemented, yet\n"); - } elsif (!-e $dst) { - 'maildir'; # the default + } elsif (!-e $dst || -d _) { + 'maildir'; # the default TODO: MH? } elsif (-f _ || -p _) { $lei->fail("unable to determine mbox family of $dst\n"); - } elsif (-d _) { # TODO: MH? - 'maildir'; } else { $lei->fail("unable to determine format of $dst\n"); } diff --git a/lib/PublicInbox/LeiToMail.pm b/lib/PublicInbox/LeiToMail.pm index 49b5c8ab4cbdb3cb04480725dee6e7473c38cbfd..9d9b57486ecda64c963a071a29b5e6648a734923 100644 --- a/lib/PublicInbox/LeiToMail.pm +++ b/lib/PublicInbox/LeiToMail.pm @@ -343,8 +343,8 @@ -e $dst && !-d _ and die "$dst exists and is not a directory\n"; $lei->{ovv}->{dst} = $dst .= '/' if substr($dst, -1) ne '/'; } elsif (substr($fmt, 0, 4) eq 'mbox') { - -e $dst && !-f _ && !-p _ and die - "$dst exists and is not a regular file\n"; + (-d $dst || (-e _ && !-w _)) and die + "$dst exists and is not a writable file\n"; $self->can("eml2$fmt") or die "bad mbox --format=$fmt\n"; $self->{base_type} = 'mbox'; } else { diff --git a/t/lei.t b/t/lei.t index 64cb5f0ef55378d4e4f9f5fb4ef689d304a3cf0e..d49dc01aac1a4bdf2bda4ed5d4945f5a71e7fa2c 100644 --- a/t/lei.t +++ b/t/lei.t @@ -187,7 +187,7 @@ 'error shown'); is($? >> 8, 1, 'errored out with exit 1'); ok(!$lei->(qw(q s:prefix -f mboxcl2 -o), $home), 'bad mbox'); - like($err, qr!\Q$home\E exists and is not a regular file!, + like($err, qr!\Q$home\E exists and is not a writable file!, 'error shown'); is($? >> 8, 1, 'errored out with exit 1');