[Haskell-cafe] Determining application directory

Vladimir Matveev dpx.infinity at gmail.com
Wed Jan 27 13:02:49 EST 2010


Program directory is not system directory. So it doesn't have CSIDL.
Program directory is the folder where executable file is located.
I certainly remember that there is a way to get it without, for example,
setting it in registry during install...

On Wed, Jan 27, 2010 at 12:31:19PM -0500, Rahul Kapoor wrote:
> > 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]
> 
> 
> Links.
> [1] http://msdn.microsoft.com/en-us/library/bb762494%28VS.85%29.a


More information about the Haskell-Cafe mailing list