What follows is a patch I have found useful. It augments Xavante's
extension to MIME type look-up table with the contents
of /etc/mime.types should it exist, allowing users to add types without
having to rebuild Xavante, etc.
=== modified file 'src/xavante/mime.lua'
--- src/xavante/mime.lua 2010-03-17 14:31:43 +0000
+++ src/xavante/mime.lua 2010-03-17 14:37:36 +0000
@@ -1,8 +1,9 @@
-----------------------------------------------------------------------------
-- Xavante MIME types
--
--- Authors: Javier Guerra and Andre Carregal
+-- Authors: Javier Guerra and Andre Carregal, and Rob Kendrick
-- Copyright (c) 2004-2007 Kepler Project
+-- Copyright 2010 Simtec Electronics
--
-- $Id: mime.lua,v 1.7 2007/08/20 22:20:44 carregal Exp $
-----------------------------------------------------------------------------
@@ -172,3 +173,21 @@
movie = "video/x-sgi-movie",
ice = "x-conference/x-cooltalk",
}
+
+do
+ -- integrate contents of system mime.types if it exists
+ local m = xavante.mimetypes
+ local fh = io.open "/etc/mime.types"
+ if not fh then return end
+
+ for l in fh:lines() do
+ local mime, extns = l:match "^([^#%s]%S*)%s+(.*)$"
+ if mime then
+ for e in extns:gmatch "%S+" do
+ m[e] = mime
+ end
+ end
+ end
+
+ fh:close()
+end
--
Rob Kendrick, Support Team Lead Simtec Electronics
Telephone: +44 (0)1772 978013 Avondale Drive, Tarleton
Fax: +44 (0)1772 816426 Preston, Lancs, PR4 6AX, UK
http://www.simtec.co.uk/ mailto:[email protected]
_______________________________________________
Kepler-Project mailing list
[email protected]
http://lists.luaforge.net/cgi-bin/mailman/listinfo/kepler-project
http://www.keplerproject.org/