Sven Schreiber schrieb:
Allin Cottrell schrieb:
> On Sun, 14 Mar 2010, Sven Schreiber wrote:
>
>> The essential structure of the script is:
>>
>> open file_in_same_directory.gdt
>> include ../script_in_upperlevel_dir.inp
>>
>> And the "jump" to ../ seems to confuse the path-finding apparatus.
> It's rather that doing "include" has switched the "current"
path
> to the one where the second .inp file was found. Bug or feature?
> For the present I've modified the behavior so that "include"
> doesn't alter the "current" path.
>
Thanks!
A follow-up question: Your explanation sounds as if the current path is
"fixed" at where the top-level script resides. For the sake of my
question consider the following arrangement:
<some_dir>/toplevelscript.inp
<some_dir>/nextlevel/secondscript.inp
<some_dir>/nextlevel/thirdscript.inp
And 'toplevelscript.inp' contains:
include nextlevel/secondscript.inp
while 'secondscript.inp' contains:
include thirdscript.inp
Would that situation fail? (Because the 'current path' is fixed at
<some_dir> and thus thirdscript.inp isn't found?)
The general background is simply that I'm struggling a little on how to
organize my gretl scripts in order to achieve these two independent goals:
1) Allow code-reuse and avoid version-change chaos, and thus do not
store included backend scripts with self-written functions in the
several different places where the calling scripts reside. Instead have
a single location for them.
2) To be able to do easy backup and file-synchronization across
different machines, do not use the default gretl directories for
functions etc. Instead use my own directory hierarchy in my home dir.
I know how to achieve each of these objectives in isolation, but the
combination seems a bit difficult without using nested relative paths.
sorry I forgot something quite important, related to my other mail
yesterday:
I think that achieving the two mentioned objectives is possible
currently precisely because of the 'workdir' option thing. That's why I
was opposed to removing it earlier. But without the workdir setting
together with not fully working relative paths, I don't know how to
solve the mentioned problem. Again, each one of the solutions would be
fine with me (apart from the possibility that I may have missed
something of course).
thanks,
sven