Add add_literal_underlay and use it for the transient underlay
authorSimon McVittie <smcv@debian.org>
Fri, 7 Jan 2011 20:04:45 +0000 (20:04 +0000)
committerSimon McVittie <smcv@debian.org>
Fri, 7 Jan 2011 20:04:45 +0000 (20:04 +0000)
This means we don't need to import Cwd and use abs_path.

IkiWiki.pm
IkiWiki/Plugin/transient.pm

index 799236f35fc2e26cbbfa8a84abb711b53bffc809..7d1f5c401f3daf6f6eeb7726a46e2f36fa1a7356 100644 (file)
@@ -810,17 +810,23 @@ sub srcfile ($;$) {
        return (srcfile_stat(@_))[0];
 }
 
-sub add_underlay ($) {
+sub add_literal_underlay ($) {
        my $dir=shift;
 
-       if ($dir !~ /^\//) {
-               $dir="$config{underlaydirbase}/$dir";
-       }
-
        if (! grep { $_ eq $dir } @{$config{underlaydirs}}) {
                unshift @{$config{underlaydirs}}, $dir;
        }
+}
+
+sub add_underlay ($) {
+       my $dir = shift;
+
+       if ($dir !~ /^\//) {
+               $dir="$config{underlaydirbase}/$dir";
+       }
 
+       add_literal_underlay($dir);
+       # why does it return 1? we just don't know
        return 1;
 }
 
index c482b8552f78efbe218b71de14bf21cf97a6cd2c..9811aa010e3d31672dd930596082f83d69d7a02c 100644 (file)
@@ -25,10 +25,10 @@ sub getsetup () {
 our $transientdir;
 
 sub checkconfig () {
-       eval q{use Cwd 'abs_path'};
-       error($@) if $@;
-       $transientdir = abs_path($config{wikistatedir})."/transient";
-       add_underlay($transientdir);
+       $transientdir = $config{wikistatedir}."/transient";
+       # add_underlay treats relative underlays as relative to the installed
+       # location, not the cwd. That's not what we want here.
+       IkiWiki::add_literal_underlay($transientdir);
 }
 
 sub change (@) {