[Haskell-cafe] Abstracting configuration directories
michael at orlitzky.com
Fri Dec 20 19:09:55 UTC 2013
On 12/20/2013 08:13 AM, Henk-Jan van Tuyl wrote:
> On Fri, 20 Dec 2013 12:29:03 +0100, Henk-Jan van Tuyl
> <hjgtuyl at chello.nl> wrote:
>> You could use the environment variable AllUsersProfile for this.
> Another way to do this:
> Prelude> :m System.Win32
> Prelude System.Win32> sHGetFolderPath nullPtr 35 nullPtr 0
> "C:\\Documents and Settings\\All Users\\Application Data"
Thanks, this is what getAppUserDataDirectory (from System.Directory) is
getAppUserDataDirectory :: String -> IO FilePath
getAppUserDataDirectory appName = do
s <- Win32.sHGetFolderPath nullPtr Win32.cSIDL_APPDATA nullPtr 0
I think your path above is the correct location on Win32; in that case,
Windows makes it available as CSIDL_COMMON_APPDATA. System.Win32
doesn't use this constant at the moment, but I think it could go in 
along with the rest of them.
Then, System.Directory could provide getAppGlobalDataDirectory as you
A patch looks easy, but I'm not sure that I would call /etc the "global
data directory" on Unix. I'll have to think about it some more.
More information about the Haskell-Cafe