Some issues with project plugin ?

Alexander Neundorf neundorf at kde.org
Sun Feb 5 22:01:13 GMT 2023


Hi,

On Mittwoch, 25. Januar 2023 11:07:20 CET Christoph Cullmann (cullmann.io) 
wrote:
> On 2023-01-25 00:52, Alexander Neundorf wrote:
...
> > I could check QFileInfo::isAbsolute(), but the comment says that's too
> > slow.
> > If nobody else is faster, I'll do something in the next days.
> 
> If we only do that for the case that the user did explicit file
> specification
> in the .kateproject, speed should be no issue, that is only relevant for
> the git/...
> cases that generate file lists.

if the project is generated by cmake, the explicit file list can also be long.

But, as far as I can see, in "list" mode, the file paths are made absolute in  
KateProjectWorker::findFiles() before handed to 
KateProjectWorker::loadFilesEntry():
https://invent.kde.org/utilities/kate/-/blob/master/addons/project/
kateprojectworker.cpp#L418

The list of files can contain a mix of relative and absolute paths, also 
absolute paths outside the project directory, so I think kate has to check for 
every entry whether it is relative or absolute.

Using QFileInfo.isAbsolute() it's a one-line fix in line 328 https://
invent.kde.org/utilities/kate/-/blob/master/addons/project/
kateprojectworker.cpp#L320
, which makes the "list" mode work correctly (instead of not at all as far as 
I can see).

Shall I really add something like
bool quickIsAbsolute(QString path) {
  return ((path[0] == '/') || ((path[1] == ':') && (path[2] == '/'))); 
}
?

(do the paths under Windows actually use forward or backward slashes ?)

Alex





More information about the KWrite-Devel mailing list