changeset 162:efff86f375ed

tweak find data gear header
author anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
date Wed, 15 Jan 2020 16:26:44 +0900
parents 06bf68d3b83b
children d116d737fed0
files src/gearsTools/lib/Gears/Util.pm
diffstat 1 files changed, 8 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/gearsTools/lib/Gears/Util.pm	Tue Jan 14 20:54:21 2020 +0900
+++ b/src/gearsTools/lib/Gears/Util.pm	Wed Jan 15 16:26:44 2020 +0900
@@ -122,19 +122,23 @@
   my $header_name = shift;
 
   my $find_path = shift // ".";
-  my $header_file = '';
+  my @header_list = ();
 
   find(
     {
       wanted => sub {
-        if ($_ =~ /\/$header_name\.h/) {
-          $header_file = $_;
+        if ($_ =~ /\/$header_name\.(h|dg)/) {
+          push(@header_list,$_);
         }
       },
       no_chdir => 1,
     },
     $find_path);
-  return $header_file;
+  my @find_headers =  grep { $_ =~ /\/$header_name\.(h|dg)/} @header_list;
+  if (@find_headers > 1) {
+      @find_headers =  grep { $_ =~ /\/$header_name\.dg/} @find_headers;
+  }
+  return shift @find_headers;
 }
 
 sub find_headers_path {