Making picture-upload.pl case insensitive when looking for DATALINK.TXT or IDLINK.TXT
authorChris Nighswonger <cnighswonger@foundations.edu>
Mon, 18 Feb 2008 22:26:09 +0000 (11:26 +1300)
committerJoshua Ferraro <jmf@liblime.com>
Mon, 18 Feb 2008 22:44:04 +0000 (16:44 -0600)
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
tools/picture-upload.pl

index 598ee26..f38e462 100755 (executable)
@@ -88,9 +88,13 @@ output_html_with_http_headers $input, $cookie, $template->output;
 sub handle_dir {
     my ( $dir ) = @_;
     my ( %count );
+    my $file;
     $count{filenames} = ();
-
-    my $file = ( -r "$dir/IDLINK.TXT" ) ? "$dir/IDLINK.TXT" : "$dir/DATALINK.TXT";
+    
+    opendir my $dirhandle, $dir;
+    while ( my $filename = readdir $dirhandle ) {
+        $file = "$dir/$filename" if ($filename =~ qr/datalink\.txt/i || qr/idlink\.txt/i);
+    }
     unless (open (FILE, $file)) { 
                print "Openning $dir/$file failed!\n";
                return 0;