Make srcfile() return undef, if the file isn't there.
authorDavid Riebenbauer <davrieb@liegesta.at>
Sat, 30 Jan 2010 09:25:10 +0000 (10:25 +0100)
committerDavid Riebenbauer <davrieb@liegesta.at>
Tue, 2 Feb 2010 13:04:28 +0000 (14:04 +0100)
This has the advantage that it's now possible to check for the existence of a
sourcefile with that function.

IkiWiki.pm

index b8e599928678d31ab918cb629da94d95a35b7b1e..cb1c46a68c76d51f52730372c370ea22ee8dc97b 100644 (file)
@@ -743,7 +743,10 @@ sub srcfile_stat {
 }
 
 sub srcfile ($;$) {
-       return (srcfile_stat(@_))[0];
+       if (my @stat=srcfile_stat(@_)) {
+               return $stat[0];
+       }
+       return undef
 }
 
 sub add_underlay ($) {