Not all paths are relative in Project file when 'relative' selected and impacts resolving project cache.

I would like your comments before I file this as a bug.

Ideally there would some type of 'copy project wizard' that would take care of copying a Project in a new directory, maybe a 'Project Save as' option
with the option to duplicate all the appropriate files.

Since I don't know of such functionality I duplicated a folder containing a project that was setup to save relative paths.
When I opened the copied project.
I tried to perform a file search and replace, CTRL+R, it did not find the text I was searching for even though the text was in the file.
Using CTRL+F (Find) did find the text however multiple occurrences were not highlighted.
I tried invalidating the cache but this didn't fix the problem.

It appears that in the Project .ipr file entry:
  <component name="ProjectKey">
    <option name="state" value="project://OLD_FULL_PROJECT_PATH\icerss.ipr" />
Is not relative even though all other paths are relative.
I manually edited this to point to the new path, started the project up, invalidated the project caches, then restarted. This fixed the problem.

If ProjectKey is being used to determine which cache IJ should use then this might cause the text to not be found.

Again it appears that the text highlighting for CTRL+F is also using the cache for highlighting.
i.e: IJ was using the cache for
instead of

I suggest the following:
I realize that the project file can be accessed by alternate directory mappings or maybe by a UNC/URI address,
and determining the one true location for a project can be tricky but not impossible.
I suggest:
1) All paths in the project file should be relative when the 'store a relative path' is checked.
2) The project file should have a generated a key id to identify the cache it's is associated with. Maybe based on a hash of the computers DNS name + a random number.
3) The cache should store the absolute path to the project file.
    This absolute path should be determined using a deterministic algorithm.
4) IJ should validate on startup that the project location has not changed, if it has the cache should be regenerated --and-- a new cache key should be assigned.
    This would allow the original project cache not to be invalidated and project history to be retained.

Comments ?

Message was edited by: Rob

Please sign in to leave a comment.