<table><tr><td style="">habacker added a comment.
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D7706" rel="noreferrer">View Revision</a></tr></table><br /><div><div><blockquote style="border-left: 3px solid #a7b5bf; color: #464c5c; font-style: italic; margin: 4px 0 12px 0; padding: 4px 12px; background-color: #f8f9fc;"><p>If all you need is <APPDIR>, you can use QCoreApplication::applicationDirPath().</p></blockquote>
<p>Did a further look into this stuff and found <a href="https://cgit.kde.org/kinit.git/commit/src/kdeinit/kinit_win.cpp?id=6b0ddac715475d7ed36a15f180c755f0f978b7cf" class="remarkup-link" target="_blank" rel="noreferrer">https://cgit.kde.org/kinit.git/commit/src/kdeinit/kinit_win.cpp?id=6b0ddac715475d7ed36a15f180c755f0f978b7cf</a>. In KDE times there were KStandardDirs::installPath("kdedir") which returns the runtime install prefix. Is a comparable method available in KF5 ?</p>
<p>From your initial reference to QStandardPaths I assume that an universal solution at the time KStandardDirs::installPath("kdedir") has been ported to QStandardPaths was something like adding QStandardPaths::InstallLocation, but seems to be to late now. (TODO for Qt6 ?)</p>
<p>Searching my incomplete KF5 sources for CMAKE_INSTALL_PREFIX show several references to the runtime install prefix (there may be more references)</p>
<p>find -name '*.cpp' -exec grep -Hn CMAKE_INSTALL_PREFIX {} \;<br />
./kconfig/src/kconf_update/kconf_update.cpp:766: path = CMAKE_INSTALL_PREFIX "/" LIB_INSTALL_DIR "/kconf_update_bin/" + script;<br />
./kdelibs4support/src/kdecore/kstandarddirs.cpp:370: return QFile::decodeName(CMAKE_INSTALL_PREFIX "/") + relPath;<br />
./kdelibs4support/src/kdecore/kstandarddirs.cpp:1196: typeInstallPath = QFile::decodeName(CMAKE_INSTALL_PREFIX "/") + QLatin1String("share/applications/");<br />
./kdelibs4support/kde-config.cpp:88: printResult(QFile::decodeName(CMAKE_INSTALL_PREFIX));<br />
./kdelibs4support/autotests/kstandarddirstest.cpp:52: if (kconfig_compilerLocation.startsWith(CMAKE_INSTALL_PREFIX)) {<br />
./kdelibs4support/autotests/kstandarddirstest.cpp:141: return QFile::exists(CMAKE_INSTALL_PREFIX "/bin/kf5-config");<br />
./kdelibs4support/autotests/kstandarddirstest.cpp:441: const QString kdeDataApps = KStandardDirs::realPath(CMAKE_INSTALL_PREFIX "/share/applications/");<br />
./kdelibs4support/autotests/kstandarddirstest.cpp:484: const QString kdeDataApps = KStandardDirs::realPath(CMAKE_INSTALL_PREFIX "/share/applications/");<br />
./sonnet/src/plugins/aspell/aspellclient.cpp:36: // A generated config-aspell.h (or config-kspell.h, if shared) should be added then, to define CMAKE_INSTALL_PREFIX<br />
./sonnet/src/plugins/aspell/aspellclient.cpp:37: return QLatin1String(CMAKE_INSTALL_PREFIX ASPELL_DATA_ROOT);<br />
./kinit/src/kdeinit/kinit.cpp:631: CMAKE_INSTALL_PREFIX "/" LIB_INSTALL_DIR "/");<br />
./kinit/src/kdeinit/kinit.cpp:1541: QString path = QFile::decodeName(CMAKE_INSTALL_PREFIX "/" LIB_INSTALL_DIR "/") + lib;<br />
./kxmlgui/src/kbugreport.cpp:553: command = QFile::decodeName(CMAKE_INSTALL_PREFIX "/" KF5_LIBEXEC_INSTALL_DIR "/ksendbugmail");</p>
<p>so I would say yes in KF5 there is the need to have a common function to get the runtime install prefix [1] instead of implementing it on every mentioned place [2].</p>
<p>Using QCoreApplication::applicationDirPath() falls in category [2] while using QLibraryInfo::location falls into category[1] because from my experience every KF5 application on Windows needs a qt.conf for finding correct pathes. <br />
Unfortunally using QLibraryInfo::location on linux would change install prefix which may not work. This indicates that a replacement for KStandardDirs::installPath("kdedir") is required and leads to the question how the function should be named and where to place it ? In KDE4 times is was in kdecore . For KF5 should it be placed in kcoreaddons ?</p>
<p>This add kcoreaddons as a runtime dependency to all libraries where the above mentioned code locations belongs to. To avoid the runtime dependency it would be possible to define the function as public inline method in kcoreaddons and to add kcoreaddons as development only dependency tp related libraries. The implementation may use QLibraryInfo::location() on Windows and CMAKE_INSTALL_PREFIX on linux.</p>
<p>Any objections or a better solution ?</p></div></div><br /><div><strong>REPOSITORY</strong><div><div>R303 KInit</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D7706" rel="noreferrer">https://phabricator.kde.org/D7706</a></div></div><br /><div><strong>To: </strong>habacker, dfaure<br /><strong>Cc: </strong>dfaure, Frameworks<br /></div>