{-# LANGUAGE CPP #-}
{-# LANGUAGE NoRebindableSyntax #-}
#if __GLASGOW_HASKELL__ >= 810
{-# OPTIONS_GHC -Wno-prepositive-qualified-module #-}
#endif
{-# OPTIONS_GHC -Wno-missing-import-lists #-}
{-# OPTIONS_GHC -w #-}

{-|
Module      : Paths_Cabal
Description : Data file location, and package version and installation
              directories.

WARNING: This module was generated by Cabal. Any modifications will be
overwritten if the module is regenerated.

This module exports a function to locate data files, and values that record
the version of the package and some directories which the package has been
configured to be installed into.

For further information about Cabal's options for its configuration step, and
their default values, see the Cabal User Guide.
-}

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


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


#if defined(VERSION_base)

#if MIN_VERSION_base(4,0,0)
catchIO :: IO a -> (Exception.IOException -> IO a) -> IO a
#else
catchIO :: IO a -> (Exception.Exception -> IO a) -> IO a
#endif

#else
catchIO :: IO a -> (Exception.IOException -> IO a) -> IO a
#endif
catchIO :: forall a. IO a -> (IOException -> IO a) -> IO a
catchIO = IO a -> (IOException -> IO a) -> IO a
forall e a. Exception e => IO a -> (e -> IO a) -> IO a
Exception.catch

-- |The package version.
version :: Version
version :: Version
version = [Int] -> [String] -> Version
Version [Int
3,Int
16,Int
0,Int
0] []

-- |If the argument is a filename, the result is the name of a corresponding
-- file on the system on which the program is running, if the file were listed
-- in the @data-files@ field of the package's Cabal package description file.
-- No check is performed that the given filename is listed in that field.
getDataFileName :: FilePath -> IO FilePath
getDataFileName :: String -> IO String
getDataFileName String
name = do
  dir <- IO String
getDataDir
  return (dir `joinFileName` name)

-- |The location of the directory specified by Cabal's @--bindir@ option (where
-- executables that the user might invoke are installed). This can be overridden
-- at runtime using the environment variable Cabal_bindir.
getBinDir :: IO FilePath

-- |The location of the directory specified by Cabal's @--libdir@ option (where
-- object libraries are installed). This can be overridden at runtime using the
-- environment variable Cabal_libdir.
getLibDir :: IO FilePath

-- |The location of the directory specified by Cabal's @--dynlibdir@ option
-- (where dynamic libraries are installed). This can be overridden at runtime
-- using the environment variable Cabal_dynlibdir.
getDynLibDir :: IO FilePath

-- |The location of the directory specified by Cabal's @--datadir@ option (where
-- architecture-independent data files are installed). This can be overridden at
-- runtime using the environment variable Cabal_datadir.
getDataDir :: IO FilePath

-- |The location of the directory specified by Cabal's @--libexedir@ option
-- (where executables that are not expected to be invoked directly by the user
-- are installed). This can be overridden at runtime using the environment
-- variable Cabal_libexedir.
getLibexecDir :: IO FilePath

-- |The location of the directory specified by Cabal's @--sysconfdir@ option
-- (where configuration files are installed). This can be overridden at runtime
-- using the environment variable Cabal_sysconfdir.
getSysconfDir :: IO FilePath




bindir, libdir, dynlibdir, datadir, libexecdir, sysconfdir :: FilePath
bindir :: String
bindir     = String
"/home/allbery/.cabal/bin"
libdir :: String
libdir     = String
"/home/allbery/.cabal/lib/x86_64-linux-ghc-9.10.2-aac9/Cabal-3.16.0.0-inplace"
dynlibdir :: String
dynlibdir  = String
"/home/allbery/.cabal/lib/x86_64-linux-ghc-9.10.2-aac9"
datadir :: String
datadir    = String
"/home/allbery/.cabal/share/x86_64-linux-ghc-9.10.2-aac9/Cabal-3.16.0.0"
libexecdir :: String
libexecdir = String
"/home/allbery/.cabal/libexec/x86_64-linux-ghc-9.10.2-aac9/Cabal-3.16.0.0"
sysconfdir :: String
sysconfdir = String
"/home/allbery/.cabal/etc"

getBinDir :: IO String
getBinDir     = IO String -> (IOException -> IO String) -> IO String
forall a. IO a -> (IOException -> IO a) -> IO a
catchIO (String -> IO String
getEnv String
"Cabal_bindir")     (\IOException
_ -> String -> IO String
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return String
bindir)
getLibDir :: IO String
getLibDir     = IO String -> (IOException -> IO String) -> IO String
forall a. IO a -> (IOException -> IO a) -> IO a
catchIO (String -> IO String
getEnv String
"Cabal_libdir")     (\IOException
_ -> String -> IO String
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return String
libdir)
getDynLibDir :: IO String
getDynLibDir  = IO String -> (IOException -> IO String) -> IO String
forall a. IO a -> (IOException -> IO a) -> IO a
catchIO (String -> IO String
getEnv String
"Cabal_dynlibdir")  (\IOException
_ -> String -> IO String
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return String
dynlibdir)
getDataDir :: IO String
getDataDir    = IO String -> (IOException -> IO String) -> IO String
forall a. IO a -> (IOException -> IO a) -> IO a
catchIO (String -> IO String
getEnv String
"Cabal_datadir")    (\IOException
_ -> String -> IO String
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return String
datadir)
getLibexecDir :: IO String
getLibexecDir = IO String -> (IOException -> IO String) -> IO String
forall a. IO a -> (IOException -> IO a) -> IO a
catchIO (String -> IO String
getEnv String
"Cabal_libexecdir") (\IOException
_ -> String -> IO String
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return String
libexecdir)
getSysconfDir :: IO String
getSysconfDir = IO String -> (IOException -> IO String) -> IO String
forall a. IO a -> (IOException -> IO a) -> IO a
catchIO (String -> IO String
getEnv String
"Cabal_sysconfdir") (\IOException
_ -> String -> IO String
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return String
sysconfdir)



joinFileName :: String -> String -> FilePath
joinFileName :: String -> String -> String
joinFileName String
""  String
fname = String
fname
joinFileName String
"." String
fname = String
fname
joinFileName String
dir String
""    = String
dir
joinFileName dir :: String
dir@(Char
c:String
cs) String
fname
  | Char -> Bool
isPathSeparator (Char -> String -> Char
forall {t}. t -> [t] -> t
lastChar Char
c String
cs) = String
dir String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
fname
  | Bool
otherwise                       = String
dir String -> String -> String
forall a. [a] -> [a] -> [a]
++ Char
pathSeparator Char -> String -> String
forall a. a -> [a] -> [a]
: String
fname
 where
  -- We do not use Data.List.NonEmpty.last, as that would limit the module to
  -- base >= 4.9.0.0 (GHC >= 8.0.1).
  lastChar :: t -> [t] -> t
lastChar t
x [] = t
x
  lastChar t
_ (t
x:[t]
xs) = t -> [t] -> t
lastChar t
x [t]
xs

pathSeparator :: Char
pathSeparator :: Char
pathSeparator = Char
'/'

isPathSeparator :: Char -> Bool
isPathSeparator :: Char -> Bool
isPathSeparator Char
c = Char
c Char -> Char -> Bool
forall a. Eq a => a -> a -> Bool
== Char
'/'