winemaker: Better file renaming fix

François Gouget fgouget at codeweavers.com
Sun Apr 22 23:49:22 CDT 2001


   When processing the '#include' directives, the previous fix supposed
that all files containing special characters (spaces or '$') would have
been renamed by winemaker.
   But it occurred to me that this may not be the case if the header is
outside the tree processed by winemaker. For instance, perhaps the glibc
3.0 headers will be renamed to things like "Standard Input Output.h" in
order to be more user friendly :-).
   With this patch we try to match either the name as is, with its
special characters, or the  name as modified by winemaker so that we'll
find the file no matter what.

Changelog:

   François Gouget <fgouget at codeweavers.com>

 * tools/winemaker
   Files with special characters may not have been renamed. Try to match
both forms.


-- 
François Gouget
fgouget at codeweavers.com
-------------- next part --------------
Index: tools/winemaker
===================================================================
RCS file: /home/wine/wine/tools/winemaker,v
retrieving revision 1.24
diff -u -r1.24 winemaker
--- tools/winemaker	2001/04/20 18:26:35	1.24
+++ tools/winemaker	2001/04/21 22:27:12
@@ -1127,10 +1127,20 @@
       $dirname=dirname($dirname) . "/";
       $real_path.="../";
     } else {
+      # The file/directory may have been renamed before. Also try to 
+      # match the renamed file.
+      my $renamed=$component;
+      $renamed =~ s/[ \$]/_/g;
+      if ($renamed eq $component) {
+        undef $renamed;
+      }
+
       my $directory=get_directory_contents $dirname;
       my $found;
       foreach $dentry (@$directory) {
-	if ($dentry =~ /^$component$/i) {
+	if ($dentry =~ /^$component$/i or
+            (defined $renamed and $dentry =~ /^$renamed$/i)
+           ) {
 	  $dirname.="$dentry/";
 	  $real_path.="$dentry/";
 	  $found=1;
@@ -1175,14 +1185,12 @@
     }
   } else {
     # Here's how we proceed:
-    # - compute the 'renamed' filename (see renaming phase)
     # - split the filename we look for into its components
     # - then for each directory in the include path
     #   - trace the directory components starting from that directory
     #   - if we fail to find a match at any point then continue with 
     #     the next directory in the include path
     #   - otherwise, rejoice, our quest is over.
-    $filename =~ s/[ \$]/_/g;
     my @file_components=split /[\/\\]+/, $filename;
     #print "  Searching for $filename from @$project[$P_PATH]\n";
 
@@ -1583,7 +1591,7 @@
     }
     my $rcname=@{@$target[$T_SOURCES_RC]}[0];
     $rcname =~ s+\.rc$++i;
-    $rcname =~ s+([^/\w])+\\\1+g;
+    $rcname =~ s+([^/\w])+\\$1+g;
     print FILEO "rsrc    $rcname.res\n";
   }
   print FILEO "\n";


More information about the wine-patches mailing list