(* COCANWIKI scripts. * Written by Richard W.M. Jones . * Copyright (C) 2004 Merjis Ltd. * $Id: cocanwiki_template.ml,v 1.2 2004/09/07 14:58:34 rich Exp $ *) open Apache open Cgi open Cocanwiki_files (* Wrapper around [Cgi.Template.template] function which loads the * template from a pre-defined path and sets up some default variables. *) let get_template = let path = try Sys.getenv "COCANWIKI_TEMPLATES" with Not_found -> "/usr/share/cocanwiki/templates" in let is_dir path = try (Unix.stat path).Unix.st_kind = Unix.S_DIR with Unix.Unix_error _ -> false in if not (is_dir path) then failwith ("environment variable $COCANWIKI_TEMPLATES " ^ "must be set to point to my 'templates' directory " ^ "(see README file for more details)"); fun filename -> Template.template (path // filename)