D5447: Only add auto-detected compilers to model if they actually exist

Milian Wolff noreply at phabricator.kde.org
Mon Jan 28 10:19:07 GMT 2019

mwolff added a comment.

  In D5447#399310 <https://phabricator.kde.org/D5447#399310>, @arrowd wrote:
  > In D5447#399235 <https://phabricator.kde.org/D5447#399235>, @mwolff wrote:
  > > the path of the compiler is now always the path of the compiler in the local host, which breaks when you have a runtime with a different setup.
  > Hum. Before being passed to `rt->pathInHost()`, the compiler path gets wrapped into `KDevelop::Path`. Doesn't this make it absolute/invalid? Judging from `Path::Path(QString)` constructor, it should't even accept things like `"gcc"`.
  > And what are we checking there? I still don't make any sense from this check.
  you are right, this code should essentially do `if (rt->findExecutable(compiler->path().isEmpty()) continue;`, could you introduce that please?
  >> So, the question really is: Why was the code inloc 213 in `compilerprovider.cpp` not working for you? If `gcc` wasn't installed, we should get:
  >> - `compiler->path() == "gcc"`, i.e. not absolute
  >> - `QStandardpaths::findExecutable("gcc", path)` should always return false for all the entries in your `PATH`
  >> - we should thus never set the gcc compiler
  >>   please debug why the above didn't work for you
  > Are you talking about old code? Then it is not `QStandardpaths::findExecutable("gcc", path)` that doesn't work for me, it is `QFileInfo::exists(rt->pathInHost())` part. Why do we skip adding a compiler if it **does** exist?


> compilerprovider.cpp:214
> -        const bool absolutePath = QDir::isAbsolutePath(compiler->path());
> -        if ((absolutePath && QFileInfo::exists(rt->pathInHost(Path(compiler->path())).toLocalFile()))
> -            || QStandardPaths::findExecutable( compiler->path(), path).isEmpty() ) {

you are right - the issue is that the old code skips compilers when they exist - there's a ! missing in front of the parens here probably

  R32 KDevelop


To: arrowd, mwolff, arichardson
Cc: skalinichev, apol, kdevelop-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20190128/d998332b/attachment-0001.html>

More information about the KDevelop-devel mailing list