From f6bd81db15340bd1bfa69e98f377099036308b7b Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sat, 29 Mar 2008 21:02:47 -0400 Subject: 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. --- IkiWiki/Render.pm | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'IkiWiki') 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; -- cgit v1.2.3