From: Bernhard R. Link Date: Wed, 30 May 2012 10:03:46 +0000 (+0200) Subject: Properly detect if given a directory name as argument. X-Git-Tag: 0.04~30 X-Git-Url: https://ruderich.org/simon/gitweb/?p=blhc%2Fblhc.git;a=commitdiff_plain;h=23189f94e3761d3ef1d82b5abccf11564388b4bf;hp=2a259b08620582db1693281cded2deb29708e16b Properly detect if given a directory name as argument. Currently running blhc with a directory name as argument results in no error except it warning there are no compiler commands in it. So check if it is a proper file (or a link to a proper file). --- diff --git a/bin/blhc b/bin/blhc index b5dfa68..d5cc9d6 100755 --- a/bin/blhc +++ b/bin/blhc @@ -601,6 +601,8 @@ FILE: foreach my $file (@ARGV) { print "checking '$file'...\n" if scalar @ARGV > 1; + -f $file or die "No such file: $file"; + open my $fh, '<', $file or die $!; # Architecture of this file.