Re: [Haskell-cafe] Determining application directory

2010-02-01 Thread Vladimir Matveev
I wrote several times that I want determine application directory under
Windows only. Unix version will store its config in predefined location, 
in /etc. Anyway, one not subscribed man wrote me about special library
to solve this problem - http://hackage.haskell.org/package/executable-path

On Fri, Jan 29, 2010 at 11:16:25AM -0800, Scott A. Waterman wrote:
 'FindBin' is also useful.
 http://hackage.haskell.org/package/FindBin
 
 While System.Directory is quite useful, it doesn't contain a
 function to obtain
 the directory in which the running program lives.   You can get the
 current
 (working) directory (e.g. unix's 'getpwd'), and you can try to find an
 executable by searching the $PATH, but you can't find the program you
 are currently running.
 
 --ts
 
 On Jan 27, 2010, at 9:06 AM, Matveev Vladimir wrote:
 
 Hi,
 I'm writing cross-platform application in Haskell which should be
 running under Windows and Linux. Under Linux configuration is stored
 in the /etc directory, and under Windows configuration is meant to
 be in
 the application directory. 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?
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe
 
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Determining application directory

2010-01-29 Thread Scott A. Waterman

'FindBin' is also useful.
http://hackage.haskell.org/package/FindBin

While System.Directory is quite useful, it doesn't contain a function  
to obtain
the directory in which the running program lives.   You can get the  
current

(working) directory (e.g. unix's 'getpwd'), and you can try to find an
executable by searching the $PATH, but you can't find the program you
are currently running.

--ts

On Jan 27, 2010, at 9:06 AM, Matveev Vladimir wrote:


Hi,
I'm writing cross-platform application in Haskell which should be
running under Windows and Linux. Under Linux configuration is stored
in the /etc directory, and under Windows configuration is meant to  
be in

the application directory. 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?
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Determining application directory

2010-01-27 Thread Matveev Vladimir
Hi,
I'm writing cross-platform application in Haskell which should be
running under Windows and Linux. Under Linux configuration is stored
in the /etc directory, and under Windows configuration is meant to be in
the application directory. 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?
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Determining application directory

2010-01-27 Thread Chris Eidhof
Hi Matveev,

You might be interested in the System.Directory module:

http://hackage.haskell.org/packages/archive/directory/1.0.0.3/doc/html/System-Directory.html

HTH,

-chris

On 27 jan 2010, at 18:06, Matveev Vladimir wrote:

 Hi,
 I'm writing cross-platform application in Haskell which should be
 running under Windows and Linux. Under Linux configuration is stored
 in the /etc directory, and under Windows configuration is meant to be in
 the application directory. 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?
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Determining application directory

2010-01-27 Thread Rahul Kapoor
 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
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Determining application directory

2010-01-27 Thread Thomas DuBuisson
Other responses have been great but if you are cabalizing you might also be
interested in:

http://neilmitchell.blogspot.com/2008/02/adding-data-files-using-cabal.html

Cheers,
Thomas

On Wed, Jan 27, 2010 at 9:06 AM, Matveev Vladimir dpx.infin...@gmail.comwrote:

 Hi,
 I'm writing cross-platform application in Haskell which should be
 running under Windows and Linux. Under Linux configuration is stored
 in the /etc directory, and under Windows configuration is meant to be in
 the application directory. 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?
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Determining application directory

2010-01-27 Thread Vladimir Matveev
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
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Determining application directory

2010-01-27 Thread Vladimir Matveev
Thanks, but my program will be distributed in self-made installer (on
windows), though I'm using cabal and the sources are GPL-licensed.
Just for users' convenience :)

On Wed, Jan 27, 2010 at 09:42:45AM -0800, Thomas DuBuisson wrote:
 Other responses have been great but if you are cabalizing you might also be
 interested in:
 
 http://neilmitchell.blogspot.com/2008/02/adding-data-files-using-cabal.html
 
 Cheers,
 Thomas
 
 On Wed, Jan 27, 2010 at 9:06 AM, Matveev Vladimir 
 dpx.infin...@gmail.comwrote:
 
  Hi,
  I'm writing cross-platform application in Haskell which should be
  running under Windows and Linux. Under Linux configuration is stored
  in the /etc directory, and under Windows configuration is meant to be in
  the application directory. 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?
  ___
  Haskell-Cafe mailing list
  Haskell-Cafe@haskell.org
  http://www.haskell.org/mailman/listinfo/haskell-cafe
 
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Determining application directory

2010-01-27 Thread Vladimir Matveev
Oh yeah, it seems I found it. Solution is to use getModuleFileName and
getModuleHandle functions from System.Win32.DLL. Thanks for attention :)
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Determining application directory

2010-01-27 Thread Holger Siegel
Am Mittwoch, den 27.01.2010, 21:19 +0300 schrieb Vladimir Matveev:
 Oh yeah, it seems I found it. Solution is to use getModuleFileName and
 getModuleHandle functions from System.Win32.DLL. Thanks for attention :)

You can also use the (portable) package 'directory' from Hackage
(http://hackage.haskell.org/package/directory).


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe