QCoreApplication: document the app's bindir is in libraryPaths()

The QCoreApplicationPrivate::appendApplicationPathToLibraryPaths()
function has been there since at least Qt 4.5.1, so the documentation
for appendLibraryPaths() hasn't matched behavior for a minimum of 13
years. The documentation for libraryPaths() has mentioned this fact,
though.

Searching the application's bin dir is normal on Windows, as many
application packages are a flat install with the .exe and all .dlls in
one dir. I find it questionable to do so on Unix, though: any and all
applications expecting to be installed by a Linux distribution would not
install plugins to /usr/bin, whereas on macOS bundles have their own
organization anyway.

But I'm not prepared to change the behavior without more justification.
I can think only of broken configurations (such what is described in
QTBUG-97950 where a combination of bad decisions led to scanning all of
/usr/bin) and running an executable that is stored in a world-writable
directory.

Task-number: QTBUG-97950
Pick-to: 6.2
Change-Id: Ice04365c72984d07a64dfffd16b440868373d7a5
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
This commit is contained in:
Thiago Macieira 2021-11-03 22:25:11 -07:00
parent 1d62bf3150
commit 4fe71db2ee

View File

@ -2837,10 +2837,11 @@ void QCoreApplication::setLibraryPaths(const QStringList &paths)
it is searched for libraries first. If \a path is empty or already in the
path list, the path list is not changed.
The default path list consists of a single entry, the installation
directory for plugins. The default installation directory for plugins
is \c INSTALL/plugins, where \c INSTALL is the directory where Qt was
installed.
The default path list consists of one or two entries. The first is the
installation directory for plugins, which is \c INSTALL/plugins, where \c
INSTALL is the directory where Qt was installed. The second is the
application's own directory (\b not the current directory), but only after
the QCoreApplication object is instantiated.
The library paths are reset to the default when an instance of
QCoreApplication is destructed.