thentos-core-0.0.1.1: The swiss army knife of privacy-preserving identity management

Safe HaskellNone
LanguageHaskell2010

Paths_thentos_core__

Description

Custom modifications to the cabal-generated Paths_thentos_core.

Quick motivation: we run code in at least the following different ways:

  • the deployed binary.
  • with hspec's sensei (via the Makefile rules in the git repo root).
  • interactively (via the repl rules, same Makefile).
  • the test suite (cabal `cabal test` or `./misc/thentos-install.sh`).
  • via TH splices that run during compile time (e.g., to compile css source files as byte strings into the executable)

In order to make sure the code will find places in the file system in all these contexts, the cabal built-in functionality is almost enough, but not quite. This file adds two little quirks.

  1. In development mode (cabal flag development), getDataFileName returns the path into the package root (it just calls getPackageSourceRoot).
  2. getPackageSourceRoot is exported both from here and from Paths.TH for use in sibling packages.

Related info: http://neilmitchell.blogspot.de/2008/02/adding-data-files-using-cabal.html

Synopsis

Documentation

getPackageSourceRoot :: FilePath -> Q Exp

Takes a package name and returns a directory FilePath at compile time. The file path is determined as follows (first working method wins):

  1. Shell variable. Example: CABAL_PACKAGE_SOURCE_ROOT_THENTOS_CORE for package thentos-core.
  2. If current directory contains a directory with the same name as the package, take that.
  3. Like 2., but on *parent* directory.
  4. Take current directory.

WARNING: use this only for testing or build-time effects!