]> granicus.if.org Git - pgbadger/commitdiff
Add control of -o vs -O option with incremental mode.
authorDarold Gilles <gilles@darold.net>
Mon, 20 Jan 2014 17:13:37 +0000 (18:13 +0100)
committerDarold Gilles <gilles@darold.net>
Mon, 20 Jan 2014 17:13:37 +0000 (18:13 +0100)
pgbadger

index d9817880aa80a2b5ea71d7ec3b649492d700c206..11037bb9576a93c9cfa9dbd1412e0c3cdf21deee 100755 (executable)
--- 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";