From 268cbd962868e4d7265ee4fbcb9d45dc7fcb4a8c Mon Sep 17 00:00:00 2001 From: sof <unknown> Date: Wed, 17 Feb 1999 09:43:32 +0000 Subject: [PATCH] [project @ 1999-02-17 09:43:32 by sof] Perl regex tweak, take 55 --- ghc/driver/ghc-iface.lprl | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ghc/driver/ghc-iface.lprl b/ghc/driver/ghc-iface.lprl index 3fae1d10dd3a..e9f2df01c999 100644 --- a/ghc/driver/ghc-iface.lprl +++ b/ghc/driver/ghc-iface.lprl @@ -133,9 +133,12 @@ sub constructNewHiFile { $mod_name_dec =~ s/ZZ/Z/g; if ($Specific_hi_file eq '') { # -ohi is used even if module name != stem of filename. - ($hiname = $hifile_target) = $1 if $hifile_target =~ /\/?([^\/\.]+)\.$HiSuffix/; + ($hiname = $hifile_target) = $1 if $hifile_target =~ /\/?([^\/]+)\.$HiSuffix$/; if ( $mod_name_dec ne $hiname ) { - ($hidir = $hifile_target) =~ s/(.*)$hiname\.$HiSuffix/$1/; + $hidir = ''; + # strip off basename only if we've got a dirname. + ($hidir = $hifile_target) =~ s/(.*\/)[^\/]*$/$1/ + if ( $hifile_target =~ /\/$hiname\.$HiSuffix/ ); $hifile_target = $hidir . $mod_name_dec . ".$HiSuffix"; } } -- GitLab