[Haskell-cafe] Abstracting configuration directories

Joeri van Eekelen j.v.eekelen at gmail.com
Fri Dec 20 17:51:39 UTC 2013


I think the "right" way to accomplish this is through the Paths_pkg 
module generated by Cabal:

http://www.haskell.org/cabal/users-guide/developing-packages.html#accessing-data-files-from-package-code

Specifically, the getDataFile function can be used to look up the actual 
location of files specified in the data-files: field of the .cabal file. 
This should even work if someone uses a nonstandard --prefix.

On 2013-12-20 12:29, Henk-Jan van Tuyl wrote:
> On Thu, 19 Dec 2013 18:15:09 +0100, Michael Orlitzky
> <michael at orlitzky.com> wrote:
>
>> On 12/19/2013 01:40 AM, Tim C. Schroeder wrote:
>>> I think this is what you're looking for:
>>>
>>> http://hackage.haskell.org/package/directory-1.2.0.1/docs/System-Directory.html#g:2
>>>
>>>
>>
>> getAppUserDataDirectory will give me the user's configuration directory
>> (ala $HOME/.htsnrc), but not the global one (whatever I'm supposed to
>> use instead of /etc on Windows).
>
> You could use the environment variable AllUsersProfile[0] for this.
>
> The directory package should be extended with a function
> getAppGlobalDataDirectory.
>
> Regards,
> Henk-Jan van Tuyl
>
>
> [0] http://environmentvariables.org/AllUsersProfile
>
>

-- 
Joeri van Eekelen - j.v.eekelen at gmail.com


More information about the Haskell-Cafe mailing list