summaryrefslogtreecommitdiff
path: root/modules/TemplateParser.pm
diff options
context:
space:
mode:
authorelliott_c <ocielliottc@users.noreply.github.com>2008-03-19 12:25:19 +0000
committerelliott_c <ocielliottc@users.noreply.github.com>2008-03-19 12:25:19 +0000
commit0b14592eabd25ab142b4b8deb64ac837f076dac1 (patch)
treec15005cf551d3e2af4386a62132dfd312e9808b9 /modules/TemplateParser.pm
parentdc692a066bd6394f7c2bc8084d32ffd40e45ff87 (diff)
downloadMPC-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.pm20
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);
}