Re: Understanding SWI's relationship with a C++ app's working directory.

Alan Baljeu <[email protected]>
Newsgroups gmane.comp.ai.prolog.swi
Message-ID <[email protected]>
I recommend NOT using the official working directory except for initial orientation. That way, your program is in charge of the matter and you needn't worry about, e.g. a file-open dialog changing the directory without your explicit acknowledgement of the change.

Alan Baljeu

On 2014-03-04, at 3:12 PM, Jan Wielemaker <[email protected]> wrote:

> On 03/04/2014 08:43 PM, Kaitain Jones wrote:
>>> If nobody messes with it anyway, caching it cannot be a bad idea.
>> 
>> I'm troubled by the fact that I can't set what I am thinking of as being
>> the "SWI Prolog WD" without that automatically affecting the WD of the
>> entire app, i.e. that there is no concept of a WD just for the SWI
>> session (presumably it is too complex and/or time-consuming to use this
>> approach). Am I perhaps taking a completely wrong-headed approach by
>> setting the WD at all?
> 
> I don't know. The WD is (in all OSes I know) a setting of the process
> that determines how a not-absolute-file-names are resolved. It can be set
> and queried and all parts of the process must maintain a coherent view
> of it. There is basically no way to do that in a multi-threaded
> environment except for setting the WD while initializing the process and
> not touching it afterwards.
> 
> SWI-Prolog, once commonly in control of the process, maintains a cached
> value of the WD. That is coherent with the above. If the app however
> modifies the WD, it must inform SWI-Prolog. If that is infeasible (which
> it can be), we have some options. One (as said in my previous mail) is
> not to use cached values at all. Another might be to have some setting
> that tells Prolog whether or not to use caching.  That depends whether or
> not the old motivation to cache this value for performance reasons still
> makes as much sense as it did when the caching was added.
> 
> Definitely, in a platform independent way, modifying WD in components
> of a process and especially in threads is asking for trouble.
> 
>    Cheers --- Jan
> _______________________________________________
> SWI-Prolog mailing list
> [email protected]
> https://lists.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.