From 6d35f3d88f0c43d3ca426e7493e7d5af69df66b9 Mon Sep 17 00:00:00 2001 From: Alp Mestanogullari Date: Mon, 9 Jan 2017 11:02:02 +0100 Subject: [PATCH] reintroduce serveDirectory (to give some time to users to change their code), but deprecate it --- servant-server/src/Servant/Utils/StaticFiles.hs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/servant-server/src/Servant/Utils/StaticFiles.hs b/servant-server/src/Servant/Utils/StaticFiles.hs index ec1630e6..4db1ed6b 100644 --- a/servant-server/src/Servant/Utils/StaticFiles.hs +++ b/servant-server/src/Servant/Utils/StaticFiles.hs @@ -11,6 +11,8 @@ module Servant.Utils.StaticFiles , serveDirectoryFileServer , serveDirectoryEmbedded , serveDirectoryWith + , -- * Deprecated + serveDirectory ) where import Data.ByteString (ByteString) @@ -49,8 +51,6 @@ serveDirectoryWebApp :: FilePath -> Server Raw serveDirectoryWebApp = staticApp . defaultWebAppSettings . fixPath -- | Same as 'serveDirectoryWebApp', but uses `defaultFileServerSettings`. --- --- This used to be called 'serveDirectory' in @servant < 0.10@. serveDirectoryFileServer :: FilePath -> Server Raw serveDirectoryFileServer = staticApp . defaultFileServerSettings . fixPath @@ -70,6 +70,13 @@ serveDirectoryEmbedded files = staticApp (embeddedSettings files) serveDirectoryWith :: StaticSettings -> Server Raw serveDirectoryWith = staticApp +-- | Same as 'serveDirectoryFileServer'. It used to be the only +-- file serving function in servant pre-0.10 and will be kept +-- around for a few versions, but is deprecated. +serveDirectory :: FilePath -> Server Raw +serveDirectory = serveDirectoryFileServer +{-# DEPRECATED serveDirectory "Use serveDirectoryFileServer instead" #-} + fixPath :: FilePath -> FilePath fixPath = #if MIN_VERSION_wai_app_static(3,1,0)