From: Darold Gilles Date: Mon, 20 Jan 2014 17:13:37 +0000 (+0100) Subject: Add control of -o vs -O option with incremental mode. X-Git-Tag: v5.0~17 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=16558163f890d49346c6f4d40222f8dd97ec9eb1;p=pgbadger Add control of -o vs -O option with incremental mode. --- diff --git a/pgbadger b/pgbadger index d981788..11037bb 100755 --- a/pgbadger +++ b/pgbadger @@ -373,7 +373,12 @@ $img_format = 'png' if ($img_format ne 'jpeg'); if ($outfile ne '-') { if (!$outdir) { my @infs = fileparse($outfile); - $outdir = $infs[1]; + if ($infs[0] ne '') { + $outdir = $infs[1]; + } else { + # maybe a confusion between -O and -o + die "FATAL: output file $outfile is a directory, should be a file\nor maybe you want to use -O | --outdir option instead.\n"; + } } elsif (!-d "$outdir") { # An output directory have been passed as command line parameter die "FATAL: $outdir is not a directory or doesn't exist.\n";