[Haskell-cafe] Determining application directory

Rahul Kapoor rk at trie.org
Wed Jan 27 12:31:19 EST 2010

> So, is there a way to get an application
> directory path under Windows? I remember that there is a way to do this
> using WinAPI, but how to do this Haskell?

The System.Directory module has some methods to get specific
directory names in an OS agnostic manner.

The closest method that matches what you want
is "getAppUserDataDirectory" which uses the windows API function
SHGetFolderPath to get the folder for well known name. IIRC
Windows supports a notion of "Constant special item"'s and if
getAppUserDataDirectory does not do what you want you can call
SHGetFolderPath using the CSIDL you are interested in.  The code
to do so should be identical to the source
for "getAppUserDataDirectory"

CSIDL'a are listed here [1]

[1] http://msdn.microsoft.com/en-us/library/bb762494%28VS.85%29.a

More information about the Haskell-Cafe mailing list