module Paths_snap_server (
    version,
    getBinDir, getLibDir, getDataDir, getLibexecDir,
    getDataFileName, getSysconfDir
  ) where

import qualified Control.Exception as Exception
import Data.Version (Version(..))
import System.Environment (getEnv)
import Prelude

catchIO :: IO a -> (Exception.IOException -> IO a) -> IO a
catchIO = Exception.catch

version :: Version
version = Version [0,9,5,1] []
bindir, libdir, datadir, libexecdir, sysconfdir :: FilePath

bindir     = "/usr/bin"
libdir     = "/usr/lib/haskell-packages/ghc/lib/x86_64-linux-ghc-7.10.3/snap-server-0.9.5.1-1UGIN5H5u9E8ADYVFWPU8D"
datadir    = "/usr/share/snap-server"
libexecdir = "/usr/lib"
sysconfdir = "/usr/etc"

getBinDir, getLibDir, getDataDir, getLibexecDir, getSysconfDir :: IO FilePath
getBinDir = catchIO (getEnv "snap_server_bindir") (\_ -> return bindir)
getLibDir = catchIO (getEnv "snap_server_libdir") (\_ -> return libdir)
getDataDir = catchIO (getEnv "snap_server_datadir") (\_ -> return datadir)
getLibexecDir = catchIO (getEnv "snap_server_libexecdir") (\_ -> return libexecdir)
getSysconfDir = catchIO (getEnv "snap_server_sysconfdir") (\_ -> return sysconfdir)

getDataFileName :: FilePath -> IO FilePath
getDataFileName name = do
  dir <- getDataDir
  return (dir ++ "/" ++ name)