diff options
author | elliott_c <ocielliottc@users.noreply.github.com> | 2008-03-19 12:25:19 +0000 |
---|---|---|
committer | elliott_c <ocielliottc@users.noreply.github.com> | 2008-03-19 12:25:19 +0000 |
commit | 0b14592eabd25ab142b4b8deb64ac837f076dac1 (patch) | |
tree | c15005cf551d3e2af4386a62132dfd312e9808b9 /modules/TemplateParser.pm | |
parent | dc692a066bd6394f7c2bc8084d32ffd40e45ff87 (diff) | |
download | MPC-0b14592eabd25ab142b4b8deb64ac837f076dac1.tar.gz |
ChangeLogTag: Wed Mar 19 12:27:53 UTC 2008 Chad Elliott <elliott_c@ociweb.com>
Diffstat (limited to 'modules/TemplateParser.pm')
-rw-r--r-- | modules/TemplateParser.pm | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/modules/TemplateParser.pm b/modules/TemplateParser.pm index f9988997..36df37ff 100644 --- a/modules/TemplateParser.pm +++ b/modules/TemplateParser.pm @@ -1459,20 +1459,24 @@ sub perform_full_path { #If we expanded all env vars, get absolute path if ($value =~ /\$\(\w+\)/) { - $self->{'error_in_handle'} = "<%full_path%> couldn't expand environment " - . "variables in $value"; + $self->{'error_in_handle'} = "<%full_path%> couldn't expand " . + "environment variables in $value"; return $value; } my($dir) = $self->mpc_dirname($value); - if (!-e $dir) { - $self->{'error_in_handle'} = "The directory $dir does not exist -- can't ". - "convert to an absolute path in <%full_path%>\n"; - return $value; + if (-e $dir) { + $dir = Cwd::abs_path($dir); + } + elsif ($dir !~ /^(?:[\/\\]|[A-Z]:[\/\\])/i) { + ## If the directory is is not already an absolute path, then we will + ## assume that the directory is relative to the current directory + ## (which will be the location of the MPC file). + $dir = $self->getcwd() . ($self->{'cslashes'} ? '\\' : '/') . $dir; } - return Cwd::abs_path($dir) . ($self->convert_slashes() ? '\\' : '/') - . $self->mpc_basename($value); + return $dir . ($self->{'cslashes'} ? '\\' : '/') . + $self->mpc_basename($value); } |