summaryrefslogtreecommitdiff
path: root/modules/Parser.pm
diff options
context:
space:
mode:
authorelliott_c <ocielliottc@users.noreply.github.com>2003-04-24 13:15:37 +0000
committerelliott_c <ocielliottc@users.noreply.github.com>2003-04-24 13:15:37 +0000
commitd285e74276aa0b3f9b613789946d6dbf83be0ba7 (patch)
tree2616215d803a960c6d2c8b21aea37901c4dbcdfd /modules/Parser.pm
parente8ba1e0fb3ea327c0eb51ff91c20a8eed828df82 (diff)
downloadMPC-d285e74276aa0b3f9b613789946d6dbf83be0ba7.tar.gz
ChangeLogTag: Thu Apr 24 08:14:42 2003 Chad Elliott <elliott_c@ociweb.com>
Diffstat (limited to 'modules/Parser.pm')
-rw-r--r--modules/Parser.pm27
1 files changed, 20 insertions, 7 deletions
diff --git a/modules/Parser.pm b/modules/Parser.pm
index 1f2b14d3..54d4409a 100644
--- a/modules/Parser.pm
+++ b/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;
}