summaryrefslogtreecommitdiff
path: root/IkiWiki
diff options
context:
space:
mode:
authorJoey Hess <joey@kodama.kitenet.net>2008-03-29 21:02:47 -0400
committerJoey Hess <joey@kodama.kitenet.net>2008-03-29 21:02:47 -0400
commitf6bd81db15340bd1bfa69e98f377099036308b7b (patch)
treeb152102d7c4f29f426e8cf02d0cc949787ca3e3b /IkiWiki
parentb95a86c069ccbcd89104f72081cfc25f986465e3 (diff)
Added a hardlink option in the setup file, useful if the source and dest are on the same filesystem and the wiki includes large media files, which would normally be copied, wasting time and space.
Diffstat (limited to 'IkiWiki')
-rw-r--r--IkiWiki/Render.pm12
1 files changed, 11 insertions, 1 deletions
diff --git a/IkiWiki/Render.pm b/IkiWiki/Render.pm
index 302b18395..18324914b 100644
--- a/IkiWiki/Render.pm
+++ b/IkiWiki/Render.pm
@@ -211,9 +211,19 @@ sub render ($) { #{{{
writefile($output, $config{destdir}, genpage($page, $content));
}
else {
- my $srcfd=readfile($srcfile, 1, 1);
delete $depends{$file};
will_render($file, $file, 1);
+
+ if ($config{hardlink}) {
+ prep_writefile($file, $config{destdir});
+ unlink($config{destdir}."/".$file);
+ if (link($srcfile, $config{destdir}."/".$file)) {
+ return;
+ }
+ # if hardlink fails, fall back top copying
+ }
+
+ my $srcfd=readfile($srcfile, 1, 1);
writefile($file, $config{destdir}, undef, 1, sub {
my $destfd=shift;
my $cleanup=shift;