2 * Written by Richard W.M. Jones <rich@merjis.com>.
3 * Copyright (C) 2004 Merjis Ltd.
4 * $Id: cocanwiki_template.ml,v 1.2 2004/09/07 14:58:34 rich Exp $
12 (* Wrapper around [Cgi.Template.template] function which loads the
13 * template from a pre-defined path and sets up some default variables.
17 try Sys.getenv "COCANWIKI_TEMPLATES"
18 with Not_found -> "/usr/share/cocanwiki/templates" in
20 try (Unix.stat path).Unix.st_kind = Unix.S_DIR
21 with Unix.Unix_error _ -> false in
22 if not (is_dir path) then
23 failwith ("environment variable $COCANWIKI_TEMPLATES " ^
24 "must be set to point to my 'templates' directory " ^
25 "(see README file for more details)");
27 Template.template (path // filename)