diff options
author | elliott_c <ocielliottc@users.noreply.github.com> | 2003-04-24 13:15:37 +0000 |
---|---|---|
committer | elliott_c <ocielliottc@users.noreply.github.com> | 2003-04-24 13:15:37 +0000 |
commit | b7f5fb79ee2f49c76f49c5861a14c2bf48a078ce (patch) | |
tree | 5c6d3f7bd202cbdf17bc07090f37dc728eec92e0 /bin/MakeProjectCreator/modules/Parser.pm | |
parent | f2eeef3bc859790c72cd961869ecd26371b22194 (diff) | |
download | ATCD-b7f5fb79ee2f49c76f49c5861a14c2bf48a078ce.tar.gz |
ChangeLogTag: Thu Apr 24 08:14:42 2003 Chad Elliott <elliott_c@ociweb.com>
Diffstat (limited to 'bin/MakeProjectCreator/modules/Parser.pm')
-rw-r--r-- | bin/MakeProjectCreator/modules/Parser.pm | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/bin/MakeProjectCreator/modules/Parser.pm b/bin/MakeProjectCreator/modules/Parser.pm index 1f2b14d3dc1..54d4409ac3d 100644 --- a/bin/MakeProjectCreator/modules/Parser.pm +++ b/bin/MakeProjectCreator/modules/Parser.pm @@ -44,12 +44,25 @@ sub cd { my($self) = shift; my($dir) = shift; my($status) = chdir($dir); + if ($status && $dir ne '.') { - if ($dir =~ /^\// || $dir =~ /^[A-Za-z]:/) { - $cwd = $dir; + ## First strip out any /./ or ./ or /. + $dir =~ s/\/\.\//\//g; + $dir =~ s/^\.\///; + $dir =~ s/\/\.$//; + + ## If the new directory contains a relative directory + ## then we just get the real working directory + if ($dir =~ /\.\./) { + $cwd = Cwd::getcwd(); } else { - $cwd .= "/$dir"; + if ($dir =~ /^\// || $dir =~ /^[A-Za-z]:/) { + $cwd = $dir; + } + else { + $cwd .= "/$dir"; + } } } return $status; @@ -141,16 +154,16 @@ sub get_include_path { sub search_include_path { - my($self) = shift; - my($file) = shift; - my($found) = undef; + my($self) = shift; + my($file) = shift; + my($found) = undef; foreach my $include (@{$self->{'include'}}, '.') { if (-r "$include/$file") { $found = "$include/$file"; last; } - } + } return $found; } |