[Geany-devel] [PATCH 12/19] Use relative paths in the project files

Jiří Techet techet at xxxxx
Wed Aug 4 23:59:46 UTC 2010


Right now projects cannot be moved to other directories without
losing the base directory setting of the project and the list
of open files. This makes the project totally unportable to different
machines because even if the directory structure under your home is
identical, the user name can be different so the path is different too.

The paths should be relative to the project file, which is what
every other IDE I know does. If you keep the project file in the
same relative path to the project files, you can move it wherever you
want.

This patch does this in a backwards-compatible way - when the path
in the project settings file is absolute, it uses the absoulte path.
However, when the project is saved, all paths are converted to relative.
This means that all new applications will be able to read the old
project definition files but the old applications won't read
the new files (or more precisely, the paths in them).

For the global session file absolute paths are still used mainly because in
Windows you cannot create a relative path to a different volume and the
global settings file can be at a volume different from the project dir.
(I don't expect anyone has the project definition file at different
volume than the project files so this shouldn't be an issue for projects).

As Dimitar suggested, absolute paths could be used for files outside
the base directory which makes sense because the paths outside the project
would be preserved even if the project moves somewhere else. This feature
can be included depending on the further discussion.

One more possibility is to add a settings option (either per project or
global) that determines what kind of paths should be used.

Signed-off-by: Jiří Techet <techet at gmail.com>
---
 src/keyfile.c |   39 ++++++++++++++++++++++++++++++++++-----
 src/keyfile.h |    2 +-
 src/project.c |   26 +++++++++++++++++++++++---
 3 files changed, 58 insertions(+), 9 deletions(-)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0012-Use-relative-paths-in-the-project-files.patch
Type: text/x-patch
Size: 6103 bytes
Desc: not available
URL: <http://lists.geany.org/pipermail/devel/attachments/20100805/e60a3b5b/attachment.bin>


More information about the Devel mailing list