<?xml version="1.0" encoding="windows-1252"?>
<node id="999164" title="Re: Directory independent processing" created="2012-10-15 15:53:56" updated="2012-10-15 15:53:56">
<type id="11">
note</type>
<author id="616540">
moritz</author>
<data>
<field name="doctext">
&lt;blockquote&gt;and make these programs aware of their immediate surrounding structures regardless of where in the directory tree the folder 'project' is placed ?.&lt;/blockquote&gt;

&lt;p&gt;"regardless" is a rather strong word; if your scripts should really find their project directory on their own, without any helping assumptions or config files, they'd have to recursively search all directories -- in general that's a very bad idea.&lt;/p&gt;

&lt;p&gt;I know several approaches that some programs out there in the wild take (and often they take several of those in combination),  listed in no particular order:

&lt;ul&gt;
  &lt;li&gt;Assume that the current working directory is the project dir&lt;/li&gt;
  &lt;li&gt;Search the current directory and all of its parents for special files/directories. For example git, the distributed version control system, does that for finding repositories&lt;/li&gt;
  &lt;li&gt;Search in hard-coded places&lt;/li&gt;
  &lt;li&gt;Search for config files in hard-coded places, and read them to determine where to go&lt;/li&gt;
  &lt;li&gt;Search in directories relative to your home directory&lt;/li&gt;
  &lt;li&gt;Search relatively to the installation path of the binary&lt;/li&gt;
  &lt;li&gt;Use environment variables and/or command line options to find project dirs.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In the end, it all depends on what you want, and on the usualy work flow. Maybe you like some of the options I've listed.&lt;/p&gt;

&lt;!-- Node text goes above. Div tags should contain sig only --&gt;
&lt;div class="pmsig"&gt;&lt;div class="pmsig-616540"&gt;
[http://perl6.org/|Perl 6 - the future is here, just unevenly distributed]
&lt;/div&gt;&lt;/div&gt;</field>
<field name="root_node">
999160</field>
<field name="parent_node">
999160</field>
</data>
</node>
