Re: [eclipse-clp-users] Finding the ECLiPSE startup directory

From: Kish Shen <kisshen_at_...5...>
Date: Mon, 16 Mar 2009 17:26:15 +0000
Paulo Moura wrote:
> On 2009/03/16, at 14:05, Paulo Moura wrote:
>> I'm looking for a cross-platform solution to find the startup
>> directory when running ECLiPSe. On POSIX systems is easy as the
>> environment variable PWD is usually defined so the solution is simply
>> to use getenv/2. This, of course, doesn't work on Windows. Is there
>> any way to find the startup directory that would work across all
>> operating-systems supported by ECLiPSe?
> Please note that using getcwd/1  doesn't work as this built-in  
> predicate returns the directory of the file being compiled, not the  
> directory from which ECLiPSE was started.
> Paulo
Hi Paulo,

getcwd/1 `doesn't work' if you run it within a directive in a file that 
is compiled. This is because the current directory is changed while you 
are compiling files. [this is to enable any relative pathnames within 
your compiled files to behave in the expected way, relative to the file]

If you are running ECLiPSe interactively, or running ECLiPSe in batch 
mode. then issuing getcwd/1 (via -e command line option if you are 
running batch eclipse) will return the current working directory, which 
is the startup directory unless you have explicitly changed the directory.

I am not quite sure how useful it is to know the startup directory when 
you start ECLiPSe on Windows from the start menu -- in this case, I 
think the initial current working directory is fixed by Windows (My\ 
Document in the Vista machine I tried). Normally, if you are running 
some application, you should change the directory to the one you are 
interested in (e.g. where you application is) when you start ECLiPSe 
(and if you have embedded ECLiPSe in some external application, then its 
working directory is that of the external application).



This e-mail may contain confidential and privileged material for the
sole use of the intended recipient. Any review, use, distribution or
disclosure by others is strictly prohibited. If you are not the intended
recipient (or authorized to receive for the recipient), please contact
the sender by reply e-mail and delete all copies of this message.
Cisco Systems Limited (Company Number: 02558939), is registered in
England and Wales with its registered office at 1 Callaghan Square,
Cardiff, South Glamorgan CF10 5BT.
Received on Mon Mar 16 2009 - 17:26:25 CET

This archive was generated by hypermail 2.3.0 : Sat Aug 24 2019 - 21:14:55 CEST