... until the collector arrives ...

This "blog" is really just a scratchpad of mine. There is not much of general interest here. Most of the content is scribbled down "live" as I discover things I want to remember. I rarely go back to correct mistakes in older entries. You have been warned :)

2012-04-17

Absolute Project Pathnames in the Eclipse Workspace Hierarchy

In a "normal" Eclipse (3.x) workspace, the project directories are stored in the root of the workspace directory. That is, they are siblings of the .metadata directory. In these circumstances, the Eclipse workspace will keep an (implicit) relative path reference to each project. Consequently, if you move the workspace to a different location in the file system, Eclipse can still find the projects using that relative path.

On the other hand, Eclipse can also reference projects that lie outside of the workspace directory. In such cases the project path references are explicit and absolute. Therefore, they remain invariant if the workspace directory is moved.

So far, so good. However, there is a troublesome intermediate case. If the project directories are stored in subfolders within the workspace directory, then Eclipse does not refer to them using relative pathnames. Unexpectedly, the paths are absolute. As a result, a relocated or copied workspace will still refer to the contained projects in their original locations.

Incidentally, Eclipse 3.6 stores each project location in a file located at .metadata/project name/.location. Creating a script to alter project location paths is unnecessarily complicated by the fact that the .location files are binary.

Blog Archive