Bug #18744 2012-10-02 21:25

zuljin

File Names are wrongly displayed

File Names are wrongly displayed in "Open File List" window and in tab title if :

1) project file is on different partition than source files (*.cbp on c:\ and for example *.cpp of d:\)

2) and length of path to source file is longer that path of project file

(c:\project\proj.cbp vs "d:\project\lib\test\main.cpp")

File names are truncated and for example instead of displaying "d:\project\lib\test\main.cpp" filename is displayed as "st\main.cpp".

What is even worst if such loaded project is saved it saves to *.cbp file this malformed name and next time instead of getting file from disk d: it try to open it from disk c:

This bug was introduced between nightly 7966 and 8024.

How to reproduce:

1) Create new project and place it on disk c: in folder with short name e.g. "c:\project\proj.cbp"

2) Create new source file and place it on disk d: in folder with longer name e.g. "d:\project\lib\test\main.cpp"

3) Open this newly created file. Its name should be malformed.

Why this happen:

This happens because function void cbProject::CalculateCommonTopLevelPatch() from cbproject.cpp has bug :).

It assumes that all file names loaded from project files are relative, but this is not a case when files are on different partitions. In that case path are absolute and starts with drive letter c:\, d:\.

There is few options how to fix this issue:

1) This function should modify its wxFileName base variable from GetBasePath() to empty string - "". Because there is no common part of path if files are on different partitions. This should work but will replace everything to absolute path.

2) somehow detect that source file path is different from project path and modify assignment f->relativeToCommonTopLevelPath = .....

I could try to write some fix for that, but I'm not sure how it should work in the first place.

Category
Application::WrongBehaviour
Group
Platform:Windows
Status
Open
Close date
 
Assigned to
mortenmacfly
mortenmacfly 2012-10-11 12:35

I would vote for:

1) This function should modify its wxFileName base variable from GetBasePath() to empty string - "". Because there is no common part of path if files are on different partitions. This should work but will replace everything to absolute path.

But actually having source files cluttered across several partitions is error prone in many ways (consider debugging, for example) that it is more wise not to do it. For several issues raised with such a project we have no chance to fix it, again, as for the debugger GDB, for example.

mortenmacfly 2012-10-11 15:55

Please read here:

http://forums.codeblocks.org/index.php/topic,16947.0.html

...and try the patch. It should work for you. If it does, please report back.