[Geany] relative paths in project files: is there an option?

Jiří Techet techet at xxxxx
Thu Jun 30 21:28:21 UTC 2011


On Thu, Jun 30, 2011 at 19:07, Matthew Brush <mbrush at codebrainz.ca> wrote:
> On 06/28/11 10:28, Stephan Beal wrote:
>
>> Is there an option to enable the use of relative paths in the project
>> files?
>>
>
> I haven't checked it out yet myself, but I wonder if Jiri's GProject[1]
> plugin handles this a little better?
>
> [1] http://gitorious.org/~techy/geany/gproject-geany

There are tow different kinds of project files:

* session files - i.e. the list of open files that are stored in the
project file (those discussed in this thread). GProject just extends
Geany's project handling so these behave the same way as in Geany.

* project files - i.e. all files belonging to the project. These are
defined by the base path and a pattern list. Any file under the base
directory (and all the subdirectories) matching the pattern belongs to
the project and is displayed in the tree in the sidebar.

The patch I was mentioning previously in the thread does indeed store
relative paths to files outside the project directory like
"../../../foo/bar/baz.c". Actually the patch was created to solve a
different problem than Stephan had - it was created to solve the
problem that you lose your list of open files when you move your
project directory (which is pretty annoying when you regularly copy
your project to a different path). I wasn't thinking much about files
outside the project directory (I don't use these). With this in mind,
the best solution I think is:

* to store relative paths in addition to absolute paths only for files
below the directory where the project file is stored
* to store only the absolute path for files outside this directory (so
there's no ../ prefix in the path)

When loading the project, relative paths would be read first (when
they exist). I believe this is a quite safe approach (of course you
can fool it if you wish but you can fool any other method too). The
modification of my patch would be pretty trivial to work this way.

Cheers,
Jiri



More information about the Users mailing list