From 5bb341a58b5fc0a4b593a30370a14b4a3df486e2 Mon Sep 17 00:00:00 2001 From: elliott_c Date: Thu, 16 Oct 2003 14:02:49 +0000 Subject: ChangeLogTag: Thu Oct 16 09:02:24 2003 Chad Elliott --- ChangeLog | 7 +++++++ bin/DependencyGenerator/DependencyGenerator.pm | 16 +++++++++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index d1c38a2d1ee..dbc4a857a6d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +Thu Oct 16 09:02:24 2003 Chad Elliott + + * bin/DependencyGenerator/DependencyGenerator.pm: + + Escape regular expression special characters from strings + before they are used as regular expressions. + Thu Oct 16 08:37:54 2003 Chad Elliott * apps/gperf/tests/tests.mpc: diff --git a/bin/DependencyGenerator/DependencyGenerator.pm b/bin/DependencyGenerator/DependencyGenerator.pm index f84b31ca40e..91053a8a207 100644 --- a/bin/DependencyGenerator/DependencyGenerator.pm +++ b/bin/DependencyGenerator/DependencyGenerator.pm @@ -31,12 +31,26 @@ sub new { $options, $ipaths), 'replace' => $replace, 'dwrite' => DependencyWriterFactory::create($type), - 'cwd' => Cwd::getcwd() . '/', + 'cwd' => undef, }, $class; + + ## Set the current working directory, but + ## escape regular expression special characters + $self->{'cwd'} = $self->escape_regex_special(Cwd::getcwd()) . '/'; + return $self; } +sub escape_regex_special { + my($self) = shift; + my($name) = shift; + + $name =~ s/([\+\-\\\$\[\]\(\)\.])/\\$1/g; + return $name; +} + + sub process { my($self) = shift; my($file) = shift; -- cgit v1.2.1