improve error message if shortcuts.mdwn DNE
authorJoey Hess <joey@kitenet.net>
Mon, 17 Dec 2007 20:33:47 +0000 (15:33 -0500)
committerJoey Hess <joey@kitenet.net>
Mon, 17 Dec 2007 20:33:47 +0000 (15:33 -0500)
IkiWiki/Plugin/shortcut.pm

index 0e7769c67c7f22f36b9b1e857660cc9b8ba0ad9c..fb096ecbd8677d183634bfae095ec40895bfbf2c 100644 (file)
@@ -13,8 +13,11 @@ sub import { #{{{
 sub checkconfig () { #{{{
        # Preprocess the shortcuts page to get all the available shortcuts
        # defined before other pages are rendered.
-       IkiWiki::preprocess("shortcuts", "shortcuts",
-               readfile(srcfile("shortcuts.mdwn")));
+       my $srcfile=eval {srcfile("shortcuts.mdwn")};
+       if (! defined $srcfile) {
+               error(gettext("shortcut plugin will not work without a shortcuts.mdwn"));
+       }
+       IkiWiki::preprocess("shortcuts", "shortcuts", readfile($srcfile));
 } # }}}
 
 sub preprocess_shortcut (@) { #{{{