habacker added a comment.

  > So bin isn't in %PATH%, but found relatively to the app being run?
  
  yes
  
  > This makes me wonder if libexec could be bin/libexec/kf5/ on Windows, 
relative too.
  
  This requires to add support for finding executables located in libexec based 
on install root e.g. instead of using
  
  QString command = 
QStandardPaths::findExecutable(QStringLiteral("ksendbugmail5"));
  
  to use something like this
  
  QString installroot = getKF5Prefix();       // similar to what is implemented 
in KDE4 (see  
https://cgit.kde.org/kdelibs.git/tree/kdecore/kernel/kkernel_win.cpp?h=KDE/4.14#n97)
  QString command = 
QStandardPaths::findExecutable(QStringLiteral("ksendbugmail"), installRoot + 
QStringLiteral("bin/libexec/kf5/"));  
  or 
  QString command = 
QStandardPaths::findExecutable(QStringLiteral("ksendbugmail"), installRoot + 
QStringLiteral(KF5_LIBEXEC_INSTALL_DIR));
  
  if KF5_LIBEXEC_INSTALL_DIR is a relative path to the requested subdir based 
on the install root.
  
  > Then we could have an ECM-provided string that expands to
  >  CMAKE_INSTALL_PREFIX "/" KF5_LIBEXEC_INSTALL_DIR on Unix (i.e. absolute), 
and
  >  KF5_LIBEXEC_INSTALL_DIR on Windows (i.e. relative).
  
  
  
  > Wouldn't this keep the Unix/Windows differences to a minimum?
  
  Related to install layout it would be reduce the difference, but on the 
source code side you need to add detecting the install root to any code where 
an executable located in libexec needs to be searched, which increases the 
differences in the source code.
  
  The complete code fragment would look like 
  #ifndef Q_OS_WIN32
  
    QString command = 
QStandardPaths::findExecutable(QStringLiteral("ksendbugmail"));
    if (command.isEmpty()) {
        command = QFile::decodeName(CMAKE_INSTALL_PREFIX "/" 
KF5_LIBEXEC_INSTALL_DIR "/ksendbugmail");
  
  #else
  
    QString searchPath = getKF5Prefix() + 
QStringLiteral(KF5_LIBEXEC_INSTALL_DIR);
    QString command = 
QStandardPaths::findExecutable(QStringLiteral("ksendbugmail"), searchPath);  
  
  #endif
  
  An optimization would be to call getKF5Prefix() on non Windows too, which 
returns  CMAKE_INSTALL_PREFIX "/". This  reduced the above mentioned code to
  
  QString searchPath = getKF5Prefix() + QStringLiteral(KF5_LIBEXEC_INSTALL_DIR);
  QString command = 
QStandardPaths::findExecutable(QStringLiteral("ksendbugmail"), searchPath);
  
  BTW: You mentioned  that KF5_LIBEXEC_INSTALL_DIR is 'bin/libexec/kf5/' on 
Windows, Should it not be lib/libexec/kf5  ? On unix this is located in 
'lib[64]/libexec/kf5 '  - why this difference ?

REPOSITORY
  R263 KXmlGui

REVISION DETAIL
  https://phabricator.kde.org/D5173

To: habacker
Cc: dfaure, aacid, #frameworks

Reply via email to