diff options
author | Joey Hess <joey@kodama.kitenet.net> | 2008-03-29 21:02:47 -0400 |
---|---|---|
committer | Joey Hess <joey@kodama.kitenet.net> | 2008-03-29 21:02:47 -0400 |
commit | f6bd81db15340bd1bfa69e98f377099036308b7b (patch) | |
tree | b152102d7c4f29f426e8cf02d0cc949787ca3e3b /IkiWiki/Render.pm | |
parent | b95a86c069ccbcd89104f72081cfc25f986465e3 (diff) | |
download | ikiwiki-f6bd81db15340bd1bfa69e98f377099036308b7b.tar ikiwiki-f6bd81db15340bd1bfa69e98f377099036308b7b.tar.gz |
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/Render.pm')
-rw-r--r-- | IkiWiki/Render.pm | 12 |
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; |